added peephole conditions testing for same arguments
[fw/sdcc] / src / SDCCloop.c
index d65d40c78af651e8c12e2766201d18d09120bba6..2819c859dcbf689953057e3b814b12baf14dfbef 100644 (file)
@@ -292,10 +292,13 @@ DEFSETFUNC (createLoop)
   /* all blocks that have dfnumbers between dfMin & dfMax are also
      part of loop */
   for (i = 0 ; i < count ; i++) {
-      if (ebbs[i]->dfnum > dfMin && ebbs[i]->dfnum < dfMax) {
-             loopInsert(&aloop->regBlocks,ebbs[i]);
+      if (ebbs[i]->dfnum > dfMin && 
+         ebbs[i]->dfnum < dfMax &&
+         !isinSet(aloop->regBlocks,ebbs[i])) {
+         if (!ebbs[i]->partOfLoop) ebbs[i]->partOfLoop = aloop;
       }
   }
+
   /* now add it to the set */
   addSetHead (allRegion, aloop);
   return 0;
@@ -884,10 +887,10 @@ basicInduction (region * loopReg, eBBlock ** ebbs, int count)
                              iCode *newic = newiCode ('=', NULL,
                                        operandFromOperand (IC_RIGHT (ic)));
                              IC_RESULT (newic) = operandFromOperand (IC_RESULT (ic));
-                             OP_DEFS (IC_RESULT (newic)) =
-                               bitVectSetBit (OP_DEFS (IC_RESULT (newic)), newic->key);
-                             OP_USES (IC_RIGHT (newic)) =
-                               bitVectSetBit (OP_USES (IC_RIGHT (newic)), newic->key);
+                             OP_DEFS_SET ((IC_RESULT (newic)),
+                               bitVectSetBit (OP_DEFS (IC_RESULT (newic)), newic->key));
+                             OP_USES_SET ((IC_RIGHT (newic)),
+                               bitVectSetBit (OP_USES (IC_RIGHT (newic)), newic->key));
                              /* and add it */
                              if (eblock->sch && eblock->sch->op == LABEL)
                                addiCodeToeBBlock (eblock, newic, eblock->sch->next);