[PATCH] D34952: [ARM] Adjust ifcvt heuristic for the diamond ifcvt case
John Brawn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 06:23:49 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL307788: [ARM] Adjust ifcvt heuristic for the diamond ifcvt case (authored by john.brawn).
Changed prior to commit:
https://reviews.llvm.org/D34952?vs=105087&id=106194#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34952
Files:
llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/trunk/test/CodeGen/Thumb2/ifcvt-no-branch-predictor.ll
Index: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -1880,6 +1880,9 @@
// Diamond: TBB is the block that is branched to, FBB is the fallthrough
TUnpredCycles = TCycles + TakenBranchCost;
FUnpredCycles = FCycles + NotTakenBranchCost;
+ // The branch at the end of FBB will disappear when it's predicated, so
+ // discount it from PredCost.
+ PredCost -= 1 * ScalingUpFactor;
}
// The total cost is the cost of each path scaled by their probabilites
unsigned TUnpredCost = Probability.scale(TUnpredCycles * ScalingUpFactor);
Index: llvm/trunk/test/CodeGen/Thumb2/ifcvt-no-branch-predictor.ll
===================================================================
--- llvm/trunk/test/CodeGen/Thumb2/ifcvt-no-branch-predictor.ll
+++ llvm/trunk/test/CodeGen/Thumb2/ifcvt-no-branch-predictor.ll
@@ -95,22 +95,26 @@
}
; CHECK-LABEL: diamond2:
-; CHECK-BP: itte
-; CHECK-BP: streq
-; CHECK-BP: ldreq
-; CHECK-BP: strne
-; CHECK-NOBP: cbz
-; CHECK-NOBP: str
-; CHECK-NOBP: b
-; CHECK-NOBP: str
-; CHECK-NOBP: ldr
+; CHECK-BP: cbz
+; CHECK-BP: str
+; CHECK-BP: str
+; CHECK-BP: b
+; CHECK-BP: str
+; CHECK-BP: ldr
+; CHECK-NOBP: ittee
+; CHECK-NOBP: streq
+; CHECK-NOBP: ldreq
+; CHECK-NOBP: strne
+; CHECK-NOBP: strne
define i32 @diamond2(i32 %n, i32 %m, i32* %p, i32* %q) {
entry:
%tobool = icmp eq i32 %n, 0
br i1 %tobool, label %if.else, label %if.then
if.then:
store i32 %n, i32* %p, align 4
+ %arrayidx = getelementptr inbounds i32, i32* %p, i32 2
+ store i32 %n, i32* %arrayidx, align 4
br label %if.end
if.else:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34952.106194.patch
Type: text/x-patch
Size: 1759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170712/af99541d/attachment.bin>
More information about the llvm-commits
mailing list