Browse Source

* x86: Fixed bug in "Mov0LblCmp0Je -> Mov0JmpLblCmp0Je" optimisation
where the reference count was increased twice.

J. Gareth "Curious Kit" Moreton 3 years ago
parent
commit
3e94af163b
1 changed files with 2 additions and 3 deletions
  1. 2 3
      compiler/x86/aoptx86.pas

+ 2 - 3
compiler/x86/aoptx86.pas

@@ -8161,7 +8161,8 @@ unit aoptx86;
                           reference_reset(NewRef, 1, []);
                           NewInstr := taicpu.op_ref(A_JMP, S_NO, NewRef);
 
-                          { Now actually load the correct parameter }
+                          { Now actually load the correct parameter (this also
+                            increases the reference count) }
                           NewInstr.loadsymbol(0, DestLabel, 0);
 
                           { Get instruction before original label (may not be p under -O3) }
@@ -8169,8 +8170,6 @@ unit aoptx86;
                             { Shouldn't fail here }
                             InternalError(2021040701);
 
-                          DestLabel.increfs;
-
                           AsmL.InsertAfter(NewInstr, hp2);
                           { Add new alignment field }
       (*                    AsmL.InsertAfter(