summaryrefslogtreecommitdiff
path: root/test/Transforms/CorrelatedValuePropagation
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-06-28 01:16:18 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-06-28 01:16:18 +0000
commite4413947843c66cd71c160fffcb711a763c30914 (patch)
tree4ca6fc42d2ba2ed380e367d1dbe958dd3b4b73ce /test/Transforms/CorrelatedValuePropagation
parent532516a87bc57f21e6d99f49548e4c2adf835551 (diff)
downloadllvm-e4413947843c66cd71c160fffcb711a763c30914.tar.gz
llvm-e4413947843c66cd71c160fffcb711a763c30914.tar.bz2
llvm-e4413947843c66cd71c160fffcb711a763c30914.tar.xz
make LVI::getEdgeValue() always intersect the constraints of the edge with the range of the block. Previously it was only performing the intersection for a few cases, thus losing precision
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159320 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/CorrelatedValuePropagation')
-rw-r--r--test/Transforms/CorrelatedValuePropagation/range.ll44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/Transforms/CorrelatedValuePropagation/range.ll b/test/Transforms/CorrelatedValuePropagation/range.ll
index 4ac478b0d5..a9e27d6e1d 100644
--- a/test/Transforms/CorrelatedValuePropagation/range.ll
+++ b/test/Transforms/CorrelatedValuePropagation/range.ll
@@ -98,3 +98,47 @@ return:
%retval.0 = phi i32 [ 42, %sw.default ], [ 4, %if.then ], [ 9, %if.end ]
ret i32 %retval.0
}
+
+; CHECK: @test5
+define i1 @test5(i32 %c) nounwind {
+ %cmp = icmp slt i32 %c, 5
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+ %cmp1 = icmp eq i32 %c, 4
+ br i1 %cmp1, label %if.end, label %if.end8
+
+if.end:
+ ret i1 true
+
+if.end8:
+ %cmp2 = icmp eq i32 %c, 3
+ %cmp3 = icmp eq i32 %c, 4
+ %cmp4 = icmp eq i32 %c, 6
+; CHECK: %or = or i1 false, false
+ %or = or i1 %cmp3, %cmp4
+; CHECK: ret i1 %cmp2
+ ret i1 %cmp2
+}
+
+; CHECK: @test6
+define i1 @test6(i32 %c) nounwind {
+ %cmp = icmp ule i32 %c, 7
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+; CHECK: icmp eq i32 %c, 6
+; CHECK: br i1
+ switch i32 %c, label %if.end [
+ i32 6, label %sw.bb
+ i32 8, label %sw.bb
+ ]
+
+if.end:
+ ret i1 true
+
+sw.bb:
+ %cmp2 = icmp eq i32 %c, 6
+; CHECK: ret i1 true
+ ret i1 %cmp2
+}