Explorar el Código

* x86: "OptPass2ADD" and "OptPass2SUB" now force another iteration if "OptPass2MOV" returned True

J. Gareth "Curious Kit" Moreton hace 5 meses
padre
commit
a70e4ed9be
Se han modificado 1 ficheros con 18 adiciones y 28 borrados
  1. 18 28
      compiler/x86/aoptx86.pas

+ 18 - 28
compiler/x86/aoptx86.pas

@@ -15634,26 +15634,21 @@ unit aoptx86;
                   UpdateUsedRegs(UsedRegs, tai(p.Next));
 
                 hp2 := hp1;
+                if OptPass2MOV(hp1) then
+                  Include(OptsToCheck, aoc_ForceNewIteration);
+
+                { Reset the tracking to the current instruction }
+                RestoreUsedRegs(TempTracking);
+                ReleaseUsedRegs(TempTracking);
+
                 { if hp1 <> hp2 after the call, then hp1 got removed, so let
                   OptPass2ADD get called again }
-                if OptPass2MOV(hp1) and (hp1 <> hp2) then
-                  begin
-                    { Reset the tracking to the current instruction }
-                    RestoreUsedRegs(TempTracking);
-                    ReleaseUsedRegs(TempTracking);
 
+                if (hp1 <> hp2) then
+                  begin
                     Result := True;
                     Exit;
                   end;
-
-                { Reset the tracking to the current instruction }
-                RestoreUsedRegs(TempTracking);
-                ReleaseUsedRegs(TempTracking);
-
-                { If OptPass2MOV returned True, we don't need to set Result to
-                  True if hp1 didn't change because the ADD instruction didn't
-                  get modified and we'll be evaluating hp1 again when the
-                  peephole optimizer reaches it }
               end;
 
             { Change:
@@ -15983,26 +15978,21 @@ unit aoptx86;
                   UpdateUsedRegs(UsedRegs, tai(p.Next));
 
                 hp2 := hp1;
+                if OptPass2MOV(hp1) then
+                  Include(OptsToCheck, aoc_ForceNewIteration);
+
+                { Reset the tracking to the current instruction }
+                RestoreUsedRegs(TempTracking);
+                ReleaseUsedRegs(TempTracking);
+	 
                 { if hp1 <> hp2 after the call, then hp1 got removed, so let
                   OptPass2SUB get called again }
-                if OptPass2MOV(hp1) and (hp1 <> hp2) then
-                  begin
-                    { Reset the tracking to the current instruction }
-                    RestoreUsedRegs(TempTracking);
-                    ReleaseUsedRegs(TempTracking);
 
+                if (hp1 <> hp2) then
+                  begin
                     Result := True;
                     Exit;
                   end;
-
-                { Reset the tracking to the current instruction }
-                RestoreUsedRegs(TempTracking);
-                ReleaseUsedRegs(TempTracking);
-
-                { If OptPass2MOV returned True, we don't need to set Result to
-                  True if hp1 didn't change because the SUB instruction didn't
-                  get modified and we'll be evaluating hp1 again when the
-                  peephole optimizer reaches it }
               end;
 
             { Change: