X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCloop.c;h=ef902a31db34666905e4353dd7078146e3d806f9;hb=92c02b20c217e7cf8cc20d667816fdc4c71b9e99;hp=87523a21978a29a4c3b6e241cc0fe3dfe4b9a9d6;hpb=0299234dcc9718e0017d8a1a2d04c6b64220af2c;p=fw%2Fsdcc diff --git a/src/SDCCloop.c b/src/SDCCloop.c index 87523a21..ef902a31 100644 --- a/src/SDCCloop.c +++ b/src/SDCCloop.c @@ -231,7 +231,8 @@ DEFSETFUNC (addToExitsMarkDepth) V_ARG (region *, lr); /* mark the loop depth of this block */ - if (!ebp->depth) + //if (!ebp->depth) + if (ebp->depthdepth = depth; /* put the loop region info in the block */ @@ -445,11 +446,21 @@ loopInvariants (region * theLoop, eBBlock ** ebbs, int count) int lin, rin; cseDef *ivar; - /* if there are function calls in this block and this - is a pointer get, the function could have changed it - so skip, ISO-C99 according to David A. Long */ - if (fCallsInBlock && POINTER_GET(ic)) { - continue; + /* jwk: TODO this is only needed if the call is between + here and the definition, but I am too lazy to do that now */ + + /* if there are function calls in this block */ + if (fCallsInBlock) { + + /* if this is a pointer get */ + if (POINTER_GET(ic)) { + continue; + } + + /* if this is an assignment from a global */ + if (ic->op=='=' && isOperandGlobal(IC_RIGHT(ic))) { + continue; + } } if (SKIP_IC (ic) || POINTER_SET (ic) || ic->op == IFX) @@ -798,13 +809,6 @@ basicInduction (region * loopReg, eBBlock ** ebbs, int count) OP_SYMBOL (IC_RESULT (indIc))->isind = 1; ip = newInduction (IC_RIGHT (ic), dic->op, litValue, indIc, NULL); - if (0) { - fprintf (stderr, "%s:%d: stupid way to avoid bug #467035, but\n" - "this will keep the regressions tests going.\n", - __FILE__, __LINE__); - continue; - } continue; - /* replace the inducted variable by the iTemp */ replaceSymBySym (loopReg->regBlocks, IC_RESULT (ic), IC_RIGHT (ic)); @@ -1050,7 +1054,7 @@ loopInduction (region * loopReg, eBBlock ** ebbs, int count) /* add the induction variable vector to the last block in the loop */ lastBlock->isLastInLoop = 1; - lastBlock->linds = indVect; + lastBlock->linds = bitVectUnion(lastBlock->linds,indVect); } setToNull ((void **) &indVars);