Browse Source

* x86: Minor change to lineinfo in "MovAdd2Lea" so debugging is more logical

J. Gareth "Curious Kit" Moreton 1 year ago
parent
commit
bba8558a1a
1 changed files with 6 additions and 2 deletions
  1. 6 2
      compiler/x86/aoptx86.pas

+ 6 - 2
compiler/x86/aoptx86.pas

@@ -9927,8 +9927,8 @@ unit aoptx86;
 
             if not GetNextInstruction(InputInstr, NextInstr) or
               (
-              { The FLAGS register isn't always tracked properly, so do not
-                perform this optimisation if a conditional statement follows }
+                { The FLAGS register isn't always tracked properly, so do not
+                  perform this optimisation if a conditional statement follows }
                 not RegReadByInstruction(NR_DEFAULTFLAGS, NextInstr) and
                 not RegUsedAfterInstruction(NR_DEFAULTFLAGS, NextInstr, TmpUsedRegs)
               ) then
@@ -9951,6 +9951,10 @@ unit aoptx86;
                 taicpu(p).opcode := A_LEA;
                 taicpu(p).loadref(0, NewRef);
 
+                { For the sake of debugging, have the line info match the
+                  arithmetic instruction rather than the MOV instruction }
+                taicpu(p).fileinfo := taicpu(InputInstr).fileinfo;
+
                 RemoveInstruction(InputInstr);
 
                 Result := True;