summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/IndVarSimplify
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-09-25 19:59:57 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-09-25 19:59:57 +0000
commitd706fa8a0c281b22df73c08c08b61b3f0a460e30 (patch)
tree2708e7ef36f0617d817e6948ffa814d3869b628b /llvm/test/Transforms/IndVarSimplify
parentdf1635d3941600c1873d8eceb494edf7c32ee920 (diff)
downloadbcm5719-llvm-d706fa8a0c281b22df73c08c08b61b3f0a460e30.tar.gz
bcm5719-llvm-d706fa8a0c281b22df73c08c08b61b3f0a460e30.zip
[SCEV] Teach isLoopBackedgeGuardedByCond to exploit trip counts.
Summary: If the trip count of a specific backedge is `N`, then we know that backedge is effectively guarded by the condition `{0,+,1} u< N`. This change teaches SCEV to use this condition to prove things in `isLoopBackedgeGuardedByCond`. Depends on D12948 Depends on D12949 Reviewers: atrick, reames, majnemer, hfinkel Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12950 llvm-svn: 248608
Diffstat (limited to 'llvm/test/Transforms/IndVarSimplify')
-rw-r--r--llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll39
1 files changed, 38 insertions, 1 deletions
diff --git a/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll b/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
index 261ba387028..957ebb7cfbf 100644
--- a/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
+++ b/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
@@ -356,5 +356,42 @@ define void @func_17(i32* %len.ptr) {
ret void
}
-!0 = !{i32 0, i32 2147483647}
+define i1 @func_18(i16* %tmp20, i32* %len.addr) {
+; CHECK-LABEL: @func_18(
+entry:
+ %len = load i32, i32* %len.addr, !range !0
+ %tmp18 = icmp eq i32 %len, 0
+ br i1 %tmp18, label %bb2, label %bb0.preheader
+
+bb0.preheader:
+ br label %bb0
+
+bb0:
+; CHECK: bb0:
+ %var_0.in = phi i32 [ %var_0, %bb1 ], [ %len, %bb0.preheader ]
+ %var_1 = phi i32 [ %tmp30, %bb1 ], [ 0, %bb0.preheader ]
+ %var_0 = add nsw i32 %var_0.in, -1
+ %tmp23 = icmp ult i32 %var_1, %len
+; CHECK: br i1 true, label %stay, label %bb2.loopexit
+ br i1 %tmp23, label %stay, label %bb2
+
+stay:
+; CHECK: stay:
+ %tmp25 = getelementptr inbounds i16, i16* %tmp20, i32 %var_1
+ %tmp26 = load i16, i16* %tmp25
+ %tmp29 = icmp eq i16 %tmp26, 0
+ br i1 %tmp29, label %bb1, label %bb2
+
+bb1:
+ %tmp30 = add i32 %var_1, 1
+ %tmp31 = icmp eq i32 %var_0, 0
+ br i1 %tmp31, label %bb3, label %bb0
+
+bb2:
+ ret i1 false
+
+bb3:
+ ret i1 true
+}
+!0 = !{i32 0, i32 2147483647}
OpenPOWER on IntegriCloud