mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 10:10:33 +02:00
* x86: Fixed inefficiency in the long-range MOV optimisations
This commit is contained in:
parent
736f5edf98
commit
af1eb33a75
@ -4369,21 +4369,25 @@ unit aoptx86;
|
|||||||
if (taicpu(hp2).oper[1]^.typ = top_ref) then
|
if (taicpu(hp2).oper[1]^.typ = top_ref) then
|
||||||
ReplaceRegisterInRef(taicpu(hp2).oper[1]^.ref^, p_TargetReg, p_SourceReg);
|
ReplaceRegisterInRef(taicpu(hp2).oper[1]^.ref^, p_TargetReg, p_SourceReg);
|
||||||
|
|
||||||
{ Don't remove the first instruction if the temporary register is in use }
|
{ ReplaceRegisterInRef won't actually replace the register if it's a different size }
|
||||||
if not TempRegUsed and
|
if not RegInOp(p_TargetReg, taicpu(hp2).oper[1]^) then
|
||||||
{ ReplaceRegisterInRef won't actually replace the register if it's a different size }
|
|
||||||
not RegInOp(p_TargetReg, taicpu(hp2).oper[1]^) then
|
|
||||||
begin
|
begin
|
||||||
DebugMsg(SPeepholeOptimization + 'MovMov2Mov 6 done',p);
|
{ Don't remove the first instruction if the temporary register is in use }
|
||||||
RemoveCurrentP(p, hp1);
|
if not TempRegUsed then
|
||||||
Result:=true;
|
begin
|
||||||
JumpTracking.Free;
|
DebugMsg(SPeepholeOptimization + 'MovMov2Mov 6 done',p);
|
||||||
Exit;
|
RemoveCurrentP(p, hp1);
|
||||||
end;
|
Result:=true;
|
||||||
|
JumpTracking.Free;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
{ No need to set Result to True here. If there's another instruction later
|
{ No need to set Result to True here. If there's another instruction later
|
||||||
on that can be optimised, it will be detected when the main Pass 1 loop
|
on that can be optimised, it will be detected when the main Pass 1 loop
|
||||||
reaches what is now hp2 and passes it through OptPass1MOV. [Kit] }
|
reaches what is now hp2 and passes it through OptPass1MOV. [Kit] }
|
||||||
|
hp3 := hp2;
|
||||||
|
Continue;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
top_const:
|
top_const:
|
||||||
|
Loading…
Reference in New Issue
Block a user