From 0a0397c9f5c30e67ab1a94e4db4b5cde8288b92b Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 13 Aug 2019 22:12:52 +0000 Subject: [PATCH] * forgotten part of previous commit: fix BccB2Cond optimization on arm git-svn-id: trunk@42684 - --- compiler/arm/aoptcpu.pas | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/compiler/arm/aoptcpu.pas b/compiler/arm/aoptcpu.pas index 174b42fd04..3a22ce71c4 100644 --- a/compiler/arm/aoptcpu.pas +++ b/compiler/arm/aoptcpu.pas @@ -2315,6 +2315,7 @@ Implementation CanBeCond(hp1) and { stop on labels } not(hp1.typ=ait_label) and + { avoid that we cannot recognize the case BccB2Cond } not((hp1.typ=ait_instruction) and (taicpu(hp1).opcode=A_B)) do begin inc(l); @@ -2393,10 +2394,17 @@ Implementation { skip hp1 to } GetNextInstruction(hp1, hp1); while assigned(hp1) and - CanBeCond(hp1) do + CanBeCond(hp1) and + (l<=3) do begin inc(l); - GetNextInstruction(hp1, hp1); + if MustBeLast(hp1) then + begin + GetNextInstruction(hp1, hp1); + break; + end + else + GetNextInstruction(hp1, hp1); end; { hp1 points to yyy: } if assigned(hp1) and @@ -2409,7 +2417,13 @@ Implementation repeat if hp1.typ=ait_instruction then taicpu(hp1).condition:=condition; - GetNextInstruction(hp1,hp1); + if MustBeLast(hp1) then + begin + GetNextInstruction(hp1, hp1); + break; + end + else + GetNextInstruction(hp1, hp1); until not(assigned(hp1)) or not(CanBeCond(hp1)) or ((hp1.typ=ait_instruction) and (taicpu(hp1).opcode=A_B));