Browse Source

* improve is_loop_invariant for load nodes

git-svn-id: trunk@44252 -
florian 5 years ago
parent
commit
ac974c9ab7
1 changed files with 3 additions and 2 deletions
  1. 3 2
      compiler/optloop.pas

+ 3 - 2
compiler/optloop.pas

@@ -262,9 +262,10 @@ unit optloop;
             begin
               if (pi_dfaavailable in current_procinfo.flags) and
                 assigned(loop.optinfo) and
-                assigned(expr.optinfo) then
+                assigned(expr.optinfo) and
+                not(expr.isequal(tfornode(loop).left)) then
                 { no aliasing? }
-                result:=not(tabstractvarsym(tloadnode(expr).symtableentry).addr_taken) and
+                result:=(([nf_write,nf_modify]*expr.flags)=[]) and not(tabstractvarsym(tloadnode(expr).symtableentry).addr_taken) and
                 { no definition in the loop? }
                   not(DFASetIn(tfornode(loop).t2.optinfo^.defsum,expr.optinfo^.index));
             end;