From d3e91bb60c8597d3ee6eeb23ab79fa1f5d476e73 Mon Sep 17 00:00:00 2001 From: Jeppe Johansen Date: Mon, 3 Nov 2014 18:33:32 +0000 Subject: [PATCH] Fixed issue #26965. The peephole optimization didn't move a potential register deallocation to after the ldr instruction causing mov's to be removed. git-svn-id: trunk@28977 - --- compiler/arm/aoptcpu.pas | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/arm/aoptcpu.pas b/compiler/arm/aoptcpu.pas index 181e7b587e..52c300ca5a 100644 --- a/compiler/arm/aoptcpu.pas +++ b/compiler/arm/aoptcpu.pas @@ -563,6 +563,7 @@ Implementation TmpUsedRegs: TAllUsedRegs; tempop: tasmop; oldreg: tregister; + dealloc: tai_regalloc; function IsPowerOf2(const value: DWord): boolean; inline; begin @@ -1250,6 +1251,13 @@ Implementation if taicpu(hp1).oper[1]^.ref^.index = taicpu(p).oper[0]^.reg then taicpu(hp1).oper[1]^.ref^.index := taicpu(p).oper[1]^.reg; + dealloc:=FindRegDeAlloc(taicpu(p).oper[1]^.reg, taicpu(p.Next)); + if Assigned(dealloc) then + begin + asml.remove(dealloc); + asml.InsertAfter(dealloc,hp1); + end; + GetNextInstruction(p, hp1); asml.remove(p); p.free;