summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstSimplify
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-11-06 19:01:03 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-11-06 19:01:03 +0000
commitc01b4d2b28184d0a9efee934c8a5b7aab57984ab (patch)
treefdd6313ad25e0502f572b34f09b6b674bfa5b44f /llvm/test/Transforms/InstSimplify
parent9349dcc74a10f3056639b455d56288e62e23f13c (diff)
downloadbcm5719-llvm-c01b4d2b28184d0a9efee934c8a5b7aab57984ab.tar.gz
bcm5719-llvm-c01b4d2b28184d0a9efee934c8a5b7aab57984ab.zip
[ValueTracking] De-pessimize isImpliedCondition around unsigned compares
Summary: Currently `isImpliedCondition` will optimize "I +_nuw C < L ==> I < L" only if C is positive. This is an unnecessary restriction -- the implication holds even if `C` is negative. Reviewers: reames, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14369 llvm-svn: 252332
Diffstat (limited to 'llvm/test/Transforms/InstSimplify')
-rw-r--r--llvm/test/Transforms/InstSimplify/implies.ll13
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/test/Transforms/InstSimplify/implies.ll b/llvm/test/Transforms/InstSimplify/implies.ll
index 8e5bbf2c897..eb8db4224fa 100644
--- a/llvm/test/Transforms/InstSimplify/implies.ll
+++ b/llvm/test/Transforms/InstSimplify/implies.ll
@@ -65,7 +65,7 @@ define i1 @test3(i32 %length.i, i32 %i) {
ret i1 %res
}
-; i +_{nuw} C_{>0} <u L ==> i <u L
+; i +_{nuw} C <u L ==> i <u L
define i1 @test4(i32 %length.i, i32 %i) {
; CHECK-LABEL: @test4
; CHECK: ret i1 true
@@ -116,6 +116,17 @@ define i1 @test8(i32 %length.i, i32 %i) {
ret i1 %res
}
+; i +_{nuw} C <s L ==> i < L, even if C is negative
+define i1 @test9(i32 %length.i, i32 %i) {
+; CHECK-LABEL: @test9(
+; CHECK: ret i1 true
+ %iplus1 = add nuw i32 %i, -100
+ %var29 = icmp ult i32 %i, %length.i
+ %var30 = icmp ult i32 %iplus1, %length.i
+ %res = icmp ule i1 %var30, %var29
+ ret i1 %res
+}
+
; X >=(s) Y == X ==> Y (i1 1 becomes -1 for reasoning)
define i1 @test_sge(i32 %length.i, i32 %i) {
; CHECK-LABEL: @test_sge
OpenPOWER on IntegriCloud