mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 20:29:24 +02:00
Fixed bug in new TEST optimisation where a FLAGS check always returned "in use"
This commit is contained in:
parent
42c429bf45
commit
be448e29f6
@ -4519,6 +4519,8 @@ unit aoptx86;
|
|||||||
|
|
||||||
{ Only remove the second test if no jumps or other conditional instructions follow }
|
{ Only remove the second test if no jumps or other conditional instructions follow }
|
||||||
TransferUsedRegs(TmpUsedRegs);
|
TransferUsedRegs(TmpUsedRegs);
|
||||||
|
UpdateUsedRegs(TmpUsedRegs, tai(p.Next));
|
||||||
|
UpdateUsedRegs(TmpUsedRegs, tai(hp1.Next));
|
||||||
if not RegUsedAfterInstruction(NR_DEFAULTFLAGS, p_dist, TmpUsedRegs) then
|
if not RegUsedAfterInstruction(NR_DEFAULTFLAGS, p_dist, TmpUsedRegs) then
|
||||||
RemoveInstruction(p_dist);
|
RemoveInstruction(p_dist);
|
||||||
|
|
||||||
@ -4559,12 +4561,15 @@ unit aoptx86;
|
|||||||
TAsmLabel(taicpu(hp1_dist).oper[0]^.ref^.symbol).DecRefs;
|
TAsmLabel(taicpu(hp1_dist).oper[0]^.ref^.symbol).DecRefs;
|
||||||
|
|
||||||
DebugMsg(SPeepholeOptimization + 'TEST/JNE/TEST/JNE merged', p);
|
DebugMsg(SPeepholeOptimization + 'TEST/JNE/TEST/JNE merged', p);
|
||||||
|
RemoveInstruction(hp1_dist);
|
||||||
|
|
||||||
{ Only remove the second test if no jumps or other conditional instructions follow }
|
{ Only remove the second test if no jumps or other conditional instructions follow }
|
||||||
TransferUsedRegs(TmpUsedRegs);
|
TransferUsedRegs(TmpUsedRegs);
|
||||||
|
UpdateUsedRegs(TmpUsedRegs, tai(p.Next));
|
||||||
|
UpdateUsedRegs(TmpUsedRegs, tai(hp1.Next));
|
||||||
if not RegUsedAfterInstruction(NR_DEFAULTFLAGS, p_dist, TmpUsedRegs) then
|
if not RegUsedAfterInstruction(NR_DEFAULTFLAGS, p_dist, TmpUsedRegs) then
|
||||||
RemoveInstruction(p_dist);
|
RemoveInstruction(p_dist);
|
||||||
|
|
||||||
RemoveInstruction(hp1_dist);
|
|
||||||
Result := True;
|
Result := True;
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user