Browse Source

* do not remove register deallocations/allocation pairs if the register is written

git-svn-id: trunk@49129 -
florian 4 years ago
parent
commit
9ec85f940e
1 changed files with 3 additions and 2 deletions
  1. 3 2
      compiler/aopt.pas

+ 3 - 2
compiler/aopt.pas

@@ -219,8 +219,9 @@ Unit aopt;
                             p := hp1;
                             p := hp1;
                           End
                           End
                         { merge allocations/deallocations }
                         { merge allocations/deallocations }
-                        else if assigned(findregalloc(tai_regalloc(p).reg, tai(p.next)))
-                          and getnextinstruction(p,hp1) and
+                        else if assigned(findregalloc(tai_regalloc(p).reg, tai(p.next))) and
+                          getnextinstruction(p,hp1) and
+                          (not(RegLoadedWithNewValue(tai_regalloc(p).Reg, hp1)) or InstructionLoadsFromReg(tai_regalloc(p).Reg, hp1)) and
                           { don't merge deallocations/allocation which mark a new use of register, this
                           { don't merge deallocations/allocation which mark a new use of register, this
                             enables more possibilities for the peephole optimizer }
                             enables more possibilities for the peephole optimizer }
                           not(tai_regalloc(p).keep) then
                           not(tai_regalloc(p).keep) then