* x86: "StcClcSet(c)2Mov" optimisation now checks to see if the destination register is in use

This commit is contained in:
J. Gareth "Curious Kit" Moreton 2024-02-23 18:06:14 +00:00 committed by FPK
parent 74e47ccff6
commit 7c5847bc70

View File

@ -9578,7 +9578,13 @@ unit aoptx86;
IsJumpToLabel(taicpu(hp1_dist)) and
not (taicpu(hp1_dist).condition in [C_AE, C_NB, C_NC, C_B, C_C, C_NAE, C_BE, C_NA]) and
{ This works if hp1_dist or both are regular JMP instructions }
condition_in(taicpu(hp1).condition, taicpu(hp1_dist).condition) then
condition_in(taicpu(hp1).condition, taicpu(hp1_dist).condition) and
(
(taicpu(p_dist).oper[0]^.typ <> top_reg) or
{ Make sure the register isn't still in use, otherwise it
may get corrupted (fixes #40659) }
not RegUsedBetween(taicpu(p_dist).oper[0]^.reg, p, p_dist)
) then
begin
taicpu(p).allocate_oper(2);
taicpu(p).ops := 2;