From 9805214d340389849b9eb231f0bc8aea6a769cbb Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 18 Oct 2018 18:28:03 +0000 Subject: [PATCH] * properly take care of register allocations between the first and second instruction for the FoldLea optimization * check for ait_instruction after a GetNextInstruction function call * cosmetics git-svn-id: trunk@39983 - --- compiler/x86/aoptx86.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index 21951cedb1..2e543f9ce1 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -2398,9 +2398,10 @@ unit aoptx86; (taicpu(hp2).oper[1]^.typ = top_ref) then begin CopyUsedRegs(TmpUsedRegs); + UpdateUsedRegs(TmpUsedRegs,tai(p.next)); UpdateUsedRegs(TmpUsedRegs,tai(hp1.next)); - if (RefsEqual(taicpu(hp2).oper[1]^.ref^, taicpu(p).oper[0]^.ref^) and - not(RegUsedAfterInstruction(taicpu(hp2).oper[0]^.reg,hp2, TmpUsedRegs))) then + if (RefsEqual(taicpu(hp2).oper[1]^.ref^,taicpu(p).oper[0]^.ref^) and + not(RegUsedAfterInstruction(taicpu(hp2).oper[0]^.reg,hp2,TmpUsedRegs))) then { change mov (ref), reg add/sub/or/... reg2/$const, reg mov reg, (ref) @@ -2444,6 +2445,7 @@ unit aoptx86; (taicpu(hp1).oper[1]^.typ = top_reg) ) and ( GetNextInstruction(hp1, hp2) and + (tai(hp2).typ=ait_instruction) and (taicpu(hp2).opsize = S_Q) and ( (