Browse Source

Some more method splitting , replaced a few argument that were using
ICODE, with LLInst

Artur K 12 years ago
parent
commit
7b63b45dd5

+ 1 - 0
include/Procedure.h

@@ -157,6 +157,7 @@ public:
     void displayStats();
     void processHliCall(COND_EXPR *exp, iICODE picode);
 
+    void preprocessReturnDU(std::bitset<32> &_liveOut);
 protected:
     bool removeInEdge_Flag_and_ProcessLatch(BB *pbb, BB *a, BB *b);
     bool Case_X_and_Y(BB* pbb, BB* thenBB, BB* elseBB);

+ 1 - 1
include/ast.h

@@ -80,7 +80,7 @@ public:
     static COND_EXPR *idOther(eReg seg, eReg regi, int16_t off);
     static COND_EXPR *idParam(int off, const STKFRAME *argSymtab);
     static COND_EXPR *unary(condNodeType t, COND_EXPR *sub_expr);
-    static COND_EXPR *idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, iICODE atOffset);
+    static COND_EXPR *idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, LLInst &atOffset);
     static COND_EXPR *idFunc(Function *pproc, STKFRAME *args);
     static COND_EXPR *idID(const ID *retVal, LOCAL_ID *locsym, iICODE ix_);
     static COND_EXPR *  id(const LLInst &ll_insn, opLoc sd, Function *pProc, iICODE ix_, ICODE &duIcode, operDu du);

+ 2 - 2
include/dcc.h

@@ -143,8 +143,8 @@ char 	*writeJcondInv (HLTYPE, Function *, int *);
 
 
 /* Exported funcions from locident.c */
-boolT checkLongEq (LONG_STKID_TYPE, iICODE, int, Function *, Assignment &asgn, iICODE atOffset);
-boolT checkLongRegEq (LONGID_TYPE, iICODE, int, Function *, Assignment &asgn, iICODE);
+boolT checkLongEq (LONG_STKID_TYPE, iICODE, int, Function *, Assignment &asgn, LLInst &atOffset);
+boolT checkLongRegEq (LONGID_TYPE, iICODE, int, Function *, Assignment &asgn, LLInst &);
 eReg otherLongRegi(eReg, int, LOCAL_ID *);
 
 

+ 1 - 1
include/locident.h

@@ -124,7 +124,7 @@ public:
     int newIntIdx(int16_t seg, int16_t off, eReg regi, int ix, hlType t);
     int newLongReg(hlType t, eReg regH, eReg regL, iICODE ix_);
     int newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, int off);
-    int newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, iICODE atOffset);
+    int newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, LLInst &atOffset);
     void newIdent(hlType t, frameType f);
     void flagByteWordId(int off);
     void propLongId(uint8_t regL, uint8_t regH, const char *name);

+ 2 - 2
include/machine_x86.h

@@ -64,13 +64,13 @@ public:
     static bool physicalReg(eReg r);
     /* Writes the registers that are set in the bitvector */
     //TODO: move this into Machine_X86 ?
-    static void writeBitVector (std::ostream &ostr,const std::bitset<32> &regi)
+    static void writeRegVector (std::ostream &ostr,const std::bitset<32> &regi)
     {
         int j;
         for (j = rAX; j < INDEX_BX_SI; j++)
         {
             if (regi.test(j-1))
-                ostr << regName(eReg(j));
+                ostr << regName(eReg(j))<<" ";
         }
     }
     static eReg subRegH(eReg reg); //TODO: move these into machine_x86

+ 3 - 3
src/ast.cpp

@@ -246,7 +246,7 @@ COND_EXPR *COND_EXPR::idLongIdx (int idx)
 
 
 /* Returns an identifier conditional expression node of type LONG_VAR */
-COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, iICODE atOffset)
+COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst f, iICODE ix, operDu du, LLInst &atOffset)
 {
     int idx;
     COND_EXPR *newExp = new COND_EXPR(IDENTIFIER);
@@ -256,10 +256,10 @@ COND_EXPR *COND_EXPR::idLong(LOCAL_ID *localId, opLoc sd, iICODE pIcode, hlFirst
         newExp->expr.ident.idType = CONSTANT;
         if (f == HIGH_FIRST)
             newExp->expr.ident.idNode.kte.kte = (pIcode->ll()->src().getImm2() << 16) +
-                    atOffset->ll()->src().getImm2();
+                    atOffset.src().getImm2();
         else        /* LOW_FIRST */
             newExp->expr.ident.idNode.kte.kte =
-                    (atOffset->ll()->src().getImm2() << 16)+ pIcode->ll()->src().getImm2();
+                    (atOffset.src().getImm2() << 16)+ pIcode->ll()->src().getImm2();
         newExp->expr.ident.idNode.kte.size = 4;
     }
     /* Save it as a long expression (reg, stack or glob) */

+ 4 - 4
src/backend.cpp

@@ -282,13 +282,13 @@ void Function::codeGen (std::ostream &fs)
             cout << "  Start = "<<pBB->begin()->loc_ip;
             cout << ", end = "<<pBB->begin()->loc_ip+pBB->size()<<"\n";
             cout << "  LiveUse = ";
-            Machine_X86::writeBitVector(cout,pBB->liveUse);
+            Machine_X86::writeRegVector(cout,pBB->liveUse);
             cout << "\n  Def = ";
-            Machine_X86::writeBitVector(cout,pBB->def);
+            Machine_X86::writeRegVector(cout,pBB->def);
             cout << "\n  LiveOut = ";
-            Machine_X86::writeBitVector(cout,pBB->liveOut);
+            Machine_X86::writeRegVector(cout,pBB->liveOut);
             cout << "\n  LiveIn = ";
-            Machine_X86::writeBitVector(cout,pBB->liveIn);
+            Machine_X86::writeRegVector(cout,pBB->liveIn);
             cout <<"\n\n";
         }
 }

+ 23 - 19
src/dataflow.cpp

@@ -469,6 +469,7 @@ void BB::ProcessUseDefForFunc(eReg regi, int defRegIdx, iICODE picode)
             picode->du.lastDefRegi |= duReg[regi];
     }
 }
+
 /* If not used within this bb or in successors of this
  * bb (ie. not in liveOut), then register is useless,
  * thus remove it.  Also check that this is not a return
@@ -621,7 +622,7 @@ bool COND_EXPR::xClear (rICODE range_to_check, iICODE lastBBinst, const LOCAL_ID
         {
             regi= locId.id_arr[expr.ident.idNode.regiIdx].id.regi;
             range_to_check.advance_begin(1);
-            auto all_valid_and_high_level_after_start = range_to_check | filtered(ICODE::TypeAndValidFilter<HIGH_LEVEL>());
+            auto all_valid_and_high_level_after_start = range_to_check | filtered(ICODE::select_valid_high_level);
             for (ICODE &i : all_valid_and_high_level_after_start)
                 if ((i.du.def & duReg[regi]).any())
                     return false;
@@ -701,9 +702,7 @@ static int processCArg (Function * pp, Function * pProc, ICODE * picode, int num
         if (pp->args.numArgs > 0)
         {
             if(_exp==NULL)
-            {
                 fprintf(stderr,"Would try to adjustForArgType with null _exp\n");
-            }
             else
                 pp->args.adjustForArgType (numArgs, _exp->expType (pProc));
         }
@@ -1021,7 +1020,9 @@ int BB::findBBExps(LOCAL_ID &locals,Function *fnc)
                             case HLI_ASSIGN:
                                 _exp = _icHl.call.toId();
                                 ticode->hl()->asgn.lhs =
-                                        COND_EXPR::idLong(&locals, DST, ticode,HIGH_FIRST, picode.base(), eDEF, ++iICODE(ticode));
+                                        COND_EXPR::idLong(&locals, DST,
+                                                          ticode,HIGH_FIRST, picode.base(),
+                                                          eDEF, *(++iICODE(ticode))->ll());
                                 ticode->hl()->asgn.rhs = _exp;
                                 picode->invalidate();
                                 numHlIcodes--;
@@ -1110,24 +1111,12 @@ void Function::findExps()
     }
 }
 
-
-/** Invokes procedures related with data flow analysis.  Works on a procedure
- * at a time basis.
- * Note: indirect recursion in liveRegAnalysis is possible. */
-void Function::dataFlow(std::bitset<32> &_liveOut)
+void Function::preprocessReturnDU(std::bitset<32> &_liveOut)
 {
-    bool isAx, isBx, isCx, isDx;
-    int idx;
-
-    /* Remove references to register variables */
-    if (flg & SI_REGVAR)
-        _liveOut &= maskDuReg[rSI];
-    if (flg & DI_REGVAR)
-        _liveOut &= maskDuReg[rDI];
-
-    /* Function - return value register(s) */
     if (_liveOut.any())
     {
+        int idx;
+        bool isAx, isBx, isCx, isDx;
         flg |= PROC_IS_FUNC;
         isAx = _liveOut.test(rAX - rAX);
         isBx = _liveOut.test(rBX - rAX);
@@ -1201,6 +1190,21 @@ void Function::dataFlow(std::bitset<32> &_liveOut)
 
         }
     }
+}
+/** Invokes procedures related with data flow analysis.  Works on a procedure
+ * at a time basis.
+ * Note: indirect recursion in liveRegAnalysis is possible. */
+void Function::dataFlow(std::bitset<32> &_liveOut)
+{
+
+    /* Remove references to register variables */
+    if (flg & SI_REGVAR)
+        _liveOut &= maskDuReg[rSI];
+    if (flg & DI_REGVAR)
+        _liveOut &= maskDuReg[rDI];
+
+    /* Function - return value register(s) */
+    preprocessReturnDU(_liveOut);
 
     /* Data flow analysis */
     liveAnal = true;

+ 2 - 2
src/hlicode.cpp

@@ -602,13 +602,13 @@ void ICODE::writeDU()
     int my_idx = loc_ip;
     {
         ostringstream ostr;
-        Machine_X86::writeBitVector(ostr,du.def);
+        Machine_X86::writeRegVector(ostr,du.def);
         if (!ostr.str().empty())
             printf ("Def (reg) = %s\n", ostr.str().c_str());
     }
     {
         ostringstream ostr;
-        Machine_X86::writeBitVector(ostr,du.use);
+        Machine_X86::writeRegVector(ostr,du.use);
         if (!ostr.str().empty())
             printf ("Use (reg) = %s\n", ostr.str().c_str());
     }

+ 4 - 4
src/idioms/arith_idioms.cpp

@@ -26,8 +26,8 @@ bool Idiom5::match(iICODE pIcode)
 int Idiom5::action()
 {
     COND_EXPR *rhs,*lhs,*expr;
-    lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, m_icodes[1]);
-    rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, m_icodes[1]);
+    lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, *m_icodes[1]->ll());
+    rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, *m_icodes[1]->ll());
     expr = COND_EXPR::boolOp (lhs, rhs, ADD);
     m_icodes[0]->setAsgn(lhs, expr);
     m_icodes[1]->invalidate();
@@ -59,8 +59,8 @@ bool Idiom6::match(iICODE pIcode)
 int Idiom6::action()
 {
     COND_EXPR *rhs,*lhs,*expr;
-    lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, m_icodes[1]);
-    rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, m_icodes[1]);
+    lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], LOW_FIRST, m_icodes[0], USE_DEF, *m_icodes[1]->ll());
+    rhs = COND_EXPR::idLong (&m_func->localId, SRC, m_icodes[0], LOW_FIRST, m_icodes[0], eUSE, *m_icodes[1]->ll());
     expr = COND_EXPR::boolOp (lhs, rhs, SUB);
     m_icodes[0]->setAsgn(lhs, expr);
     m_icodes[1]->invalidate();

+ 1 - 1
src/idioms/mov_idioms.cpp

@@ -84,7 +84,7 @@ bool Idiom13::match(iICODE pIcode)
     if (not m_icodes[0]->ll()->testFlags(I) && (regi >= rAL) && (regi <= rBH))
     {
         /* Check for MOV regH, 0 */
-        if (m_icodes[1]->ll()->match(iMOV) && m_icodes[1]->ll()->testFlags(I) && (m_icodes[1]->ll()->src().getImm2() == 0))
+        if (m_icodes[1]->ll()->match(iMOV,I) && (m_icodes[1]->ll()->src().getImm2() == 0))
         {
             if (m_icodes[1]->ll()->dst.regi == (regi + 4)) //WARNING: based on distance between AH-AL,BH-BL etc.
             {

+ 1 - 1
src/idioms/neg_idioms.cpp

@@ -51,7 +51,7 @@ bool Idiom11::match (iICODE picode)
 int Idiom11::action()
 {
     COND_EXPR *lhs,*rhs;
-    lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], HIGH_FIRST,m_icodes[0], USE_DEF, m_icodes[1]);
+    lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0], HIGH_FIRST,m_icodes[0], USE_DEF, *m_icodes[1]->ll());
     rhs = COND_EXPR::unary (NEGATION, lhs);
     m_icodes[0]->setAsgn(lhs, rhs);
     m_icodes[1]->invalidate();

+ 2 - 2
src/idioms/xor_idioms.cpp

@@ -40,7 +40,7 @@ bool Idiom21::match (iICODE picode)
 int Idiom21::action()
 {
     COND_EXPR *lhs,*rhs;
-    lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0],HIGH_FIRST, m_icodes[0], eDEF, m_icodes[1]);
+    lhs = COND_EXPR::idLong (&m_func->localId, DST, m_icodes[0],HIGH_FIRST, m_icodes[0], eDEF, *m_icodes[1]->ll());
     rhs = COND_EXPR::idKte (m_icodes[1]->ll()->src().getImm2() , 4);
     m_icodes[0]->setAsgn(lhs, rhs);
     m_icodes[0]->du.use = 0;		/* clear register used in iXOR */
@@ -59,7 +59,7 @@ bool Idiom7::match(iICODE picode)
 {
     if(picode==m_end)
         return false;
-    LLOperand *dst, *src;
+    const LLOperand *dst, *src;
     m_icode=picode;
     dst = &picode->ll()->dst;
     src = &picode->ll()->src();

+ 13 - 14
src/locident.cpp

@@ -275,20 +275,20 @@ int LOCAL_ID::newLongStk(hlType t, int offH, int offL)
 /* Returns the index to an appropriate long identifier.
  * Note: long constants should be checked first and stored as a long integer
  *       number in an expression record.    */
-int LOCAL_ID::newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix,operDu du, iICODE atOffset)
+int LOCAL_ID::newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix,operDu du, LLInst &atOffset)
 {
     size_t idx;
     const LLOperand *pmH, *pmL;
 	LLInst &p_ll(*pIcode->ll());
     if (f == LOW_FIRST)
     {
-        pmL = pIcode->ll()->get(sd);
-        pmH = atOffset->ll()->get(sd);
+        pmL = p_ll.get(sd);
+        pmH = atOffset.get(sd);
     }
     else        /* HIGH_FIRST */
     {
-        pmL = atOffset->ll()->get(sd);
-        pmH = pIcode->ll()->get(sd);
+        pmL = atOffset.get(sd);
+        pmH = p_ll.get(sd);
     }
 
     if (pmL->regi == 0)                                 /* global variable */
@@ -332,15 +332,15 @@ int LOCAL_ID::newLong(opLoc sd, iICODE pIcode, hlFirst f, iICODE ix,operDu du, i
  *            idx       : idx into icode array
  *            pProc     : ptr to current procedure record
  *            rhs, lhs  : return expressions if successful. */
-boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i, Function * pProc, Assignment &asgn, iICODE atOffset)
+boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i, Function * pProc, Assignment &asgn, LLInst &atOffset)
 {
     /* pointers to LOW_LEVEL icodes */
     const LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc;
 
     pmHdst = &pIcode->ll()->dst;
-    pmLdst = &atOffset->ll()->dst;
+    pmLdst = &atOffset.dst;
     pmHsrc = &pIcode->ll()->src();
-    pmLsrc = &atOffset->ll()->src();
+    pmLsrc = &atOffset.src();
 
     if ((longId.offH == pmHdst->off) && (longId.offL == pmLdst->off))
     {
@@ -372,16 +372,15 @@ boolT checkLongEq (LONG_STKID_TYPE longId, iICODE pIcode, int i, Function * pPro
  *            pProc     : ptr to current procedure record
  *            rhs, lhs  : return expressions if successful. */
 boolT checkLongRegEq (LONGID_TYPE longId, iICODE pIcode, int i,
-                      Function * pProc, Assignment &asgn, iICODE atOffset)
+                      Function * pProc, Assignment &asgn, LLInst &atOffset)
 {
-    LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc;  /* pointers to LOW_LEVEL icodes */
-//    iICODE atOffset(pIcode);
-//    advance(atOffset,off);
+    /* pointers to LOW_LEVEL icodes */
+    const LLOperand *pmHdst, *pmLdst, *pmHsrc, *pmLsrc;
 
     pmHdst = &pIcode->ll()->dst;
-    pmLdst = &atOffset->ll()->dst;
+    pmLdst = &atOffset.dst;
     pmHsrc = &pIcode->ll()->src();
-    pmLsrc = &atOffset->ll()->src();
+    pmLsrc = &atOffset.src();
 
     if ((longId.h == pmHdst->regi) && (longId.l == pmLdst->regi))
     {

+ 9 - 9
src/proplong.cpp

@@ -248,7 +248,7 @@ void Function::propLongStk (int i, const ID &pLocId)
             continue;
         if (pIcode->ll()->getOpcode() == next1->ll()->getOpcode())
         {
-            if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, next1) == true)
+            if (checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, *next1->ll()) == true)
             {
                 switch (pIcode->ll()->getOpcode())
                 {
@@ -281,7 +281,7 @@ void Function::propLongStk (int i, const ID &pLocId)
         /* Check long conditional (i.e. 2 CMPs and 3 branches */
         else if ((pIcode->ll()->getOpcode() == iCMP) && (isLong23 (pIcode->getParent(), l23, &arc)))
         {
-            if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, l23) )
+            if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this, asgn, *l23->ll()) )
             {
                 advance(pIcode,longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, l23));
             }
@@ -291,7 +291,7 @@ void Function::propLongStk (int i, const ID &pLocId)
                  * 2 CMPs and 2 branches */
         else if ((pIcode->ll()->getOpcode() == iCMP) && isLong22 (pIcode, pEnd, l23))
         {
-            if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this,asgn, l23) )
+            if ( checkLongEq (pLocId.id.longStkId, pIcode, i, this,asgn, *l23->ll()) )
             {
                 advance(pIcode,longJCond22 (asgn.rhs, asgn.lhs, pIcode,pEnd));
             }
@@ -327,7 +327,7 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be
                 localId.id_arr[loc_ident_idx].idx.push_back(pIcode);//idx-1//insert
                 icode.setRegDU( pmL->regi, eDEF);
                 asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
-                asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, HIGH_FIRST, pIcode, eUSE, next1);
+                asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, HIGH_FIRST, pIcode, eUSE, *next1->ll());
                 icode.setAsgn(asgn.lhs, asgn.rhs);
                 next1->invalidate();
                 forced_finish=true; /* to exit the loop */
@@ -356,7 +356,7 @@ int Function::findBackwarLongDefs(int loc_ident_idx, const ID &pLocId, iICODE be
             if ((pLocId.id.longId.h == pmH->regi) && (pLocId.id.longId.l == pmL->regi))
             {
                 asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
-                asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, LOW_FIRST, pIcode/*idx*/, eUSE, next1);
+                asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode, LOW_FIRST, pIcode, eUSE, *next1->ll());
                 icode.setRegDU( pmH->regi, USE_DEF);
                 switch (icode.ll()->getOpcode())
                 {
@@ -404,7 +404,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
                     pIcode->setRegDU( next1->ll()->src().getReg2(), eUSE);
 
                     asgn.rhs = COND_EXPR::idLongIdx (loc_ident_idx);
-                    asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, next1);
+                    asgn.lhs = COND_EXPR::idLong (&this->localId, DST, pIcode,HIGH_FIRST, pIcode, eDEF, *next1->ll());
 
                     pIcode->setAsgn(asgn.lhs, asgn.rhs);
                     next1->invalidate();
@@ -435,7 +435,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
                     asgn.lhs = COND_EXPR::idLongIdx (loc_ident_idx);
                     pIcode->setRegDU( pmH->regi, USE_DEF);
                     asgn.rhs = COND_EXPR::idLong (&this->localId, SRC, pIcode,
-                                                  LOW_FIRST, pIcode, eUSE, next1);
+                                                  LOW_FIRST, pIcode, eUSE, *next1->ll());
                     switch (pIcode->ll()->getOpcode()) {
                     case iAND: asgn.rhs = COND_EXPR::boolOp (asgn.lhs, asgn.rhs, AND);
                         break;
@@ -457,7 +457,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
         /* Check long conditional (i.e. 2 CMPs and 3 branches */
         else if ((pIcode->ll()->getOpcode() == iCMP) && (isLong23 (pIcode->getParent(), long_loc, &arc)))
         {
-            if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn, long_loc))
+            if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn, *long_loc->ll()))
             {
                                 // reduce the advance by 1 here (loop increases) ?
                 advance(pIcode,longJCond23 (asgn.rhs, asgn.lhs, pIcode, arc, long_loc));
@@ -468,7 +468,7 @@ int Function::findForwardLongUses(int loc_ident_idx, const ID &pLocId, iICODE be
              * 2 CMPs and 2 branches */
         else if (pIcode->ll()->match(iCMP) && (isLong22 (pIcode, pEnd, long_loc)))
         {
-            if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn, long_loc) )
+            if (checkLongRegEq (pLocId.id.longId, pIcode, loc_ident_idx, this, asgn, *long_loc->ll()) )
             {
                 advance(pIcode,longJCond22 (asgn.rhs, asgn.lhs, pIcode,pEnd) - 1);
             }