* src/SDCCval.c (constVal): Fixed usage of 'L' modifier problems on ppc.
[fw/sdcc] / src / SDCCcse.c
index 1bff79e102f6ea631e3ddd69921710a554bd9d27..f3c27a55d521356f4bfe78a6a8c21be52135a95c 100644 (file)
@@ -34,7 +34,7 @@ newCseDef (operand * sym, iCode * ic)
   cseDef *cdp;
 
   assert (sym);
-  cdp = Safe_calloc (1, sizeof (cseDef));
+  cdp = Safe_alloc (sizeof (cseDef));
 
   cdp->sym = sym;
   cdp->diCode = ic;
@@ -1513,6 +1513,13 @@ cseBBlock (eBBlock * ebb, int computeOnly,
          if (pdic && compareType (operandType (IC_RESULT (pdic)),
                                 operandType (IC_RESULT (ic))) != 1)
            pdic = NULL;
+
+         // TODO: this must go, a weak fix for bug #467035
+         if (pdic && (pdic->level > ic->level)) {
+           // pdic was inside an inner loop
+           pdic = NULL;
+         }
+         
        }
 
       /* if found then eliminate this and add to */
@@ -1520,10 +1527,9 @@ cseBBlock (eBBlock * ebb, int computeOnly,
       /* of this with previous opcode           */
       if (pdic)
        {
-
          if (IS_ITEMP (IC_RESULT (ic)))
            {
-
+             
              /* replace in the remaining of this block */
              replaceAllSymBySym (ic->next, IC_RESULT (ic), IC_RESULT (pdic), &ebb->ndompset);
              /* remove this iCode from inexpressions of all