From b1e65ca49fca83bd215b4c8e8427560bf9083cdf Mon Sep 17 00:00:00 2001 From: "J. Gareth \"Curious Kit\" Moreton" Date: Sat, 30 Jul 2022 18:16:12 +0100 Subject: [PATCH] * x86: Fixed bug where redirected jump has its condition changed (fixes i39851) --- compiler/x86/aoptx86.pas | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index 0e438b62a1..4de2bdf485 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -6671,12 +6671,12 @@ unit aoptx86; j(c1) @lbl1 ... @lbl: - cmp ###.### (same comparison as above) + cmp ###,### (same comparison as above) j(c2) @lbl2 If c1 is a subset of c2, change to: cmp ###,### - j(c2) @lbl2 + j(c1) @lbl2 (@lbl1 may become a dead label as a result) } @@ -6716,7 +6716,6 @@ unit aoptx86; JumpLabel.DecRefs; DebugMsg(SPeepholeOptimization + 'CMP/Jcc/@Lbl/CMP/Jcc -> CMP/Jcc, redirecting first jump', p_jump); - taicpu(p_jump).condition := taicpu(hp1_dist).condition; taicpu(p_jump).loadref(0, taicpu(hp1_dist).oper[0]^.ref^); Result := True; { Don't exit yet. Since p and p_jump haven't actually been