From: johanknol Date: Wed, 31 Oct 2001 16:30:22 +0000 (+0000) Subject: fixed bug #476678 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=623bb810b444ee2b78d7546558c21595b4d10212;p=fw%2Fsdcc fixed bug #476678 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1479 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCloop.c b/src/SDCCloop.c index beb7bd56..ef902a31 100644 --- a/src/SDCCloop.c +++ b/src/SDCCloop.c @@ -446,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)