* x86: "MovMov2Mov 1" now removes the first instruction if the intermediate register is not in use afterwards.

This commit is contained in:
J. Gareth "Curious Kit" Moreton 2025-05-31 07:30:21 +01:00 committed by FPK
parent 4459510e5c
commit 6548dd0211

View File

@ -4589,6 +4589,18 @@ unit aoptx86;
DebugMsg(SPeepholeOptimization + 'MovMov2Mov 1',p);
RemoveInstruction(hp1);
Result:=true;
if (taicpu(p).oper[1]^.typ = top_reg) then
begin
TransferUsedRegs(TmpUsedRegs);
if not RegUsedAfterInstruction(taicpu(p).oper[1]^.reg, p, TmpUsedRegs) then
begin
{ reg2 is no longer in use }
DebugMsg(SPeepholeOptimization + 'Mov2Nop 6 done',p);
RemoveCurrentP(p);
end;
end;
exit;
end
else