summaryrefslogtreecommitdiff
path: root/test/Analysis/LazyValueAnalysis
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2017-12-18 14:23:30 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2017-12-18 14:23:30 +0000
commit7a7c05d83646ea4e9c988299893de8f5b7836541 (patch)
treee32f985b8e77ad0c6f397cfa3f974d621798714e /test/Analysis/LazyValueAnalysis
parent1346bcc16e7f7d43e2c3f25c8b978bb6d1e864e9 (diff)
[LVI] Support for ashr in LVI
Enhance LVI to analyze the ‘ashr’ binary operation. This leverages the infrastructure in ConstantRange for the ashr operation. Patch by Surya Kumari Jangala! Differential Revision: https://reviews.llvm.org/D40886 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/LazyValueAnalysis')
-rw-r--r--test/Analysis/LazyValueAnalysis/lvi-for-ashr.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Analysis/LazyValueAnalysis/lvi-for-ashr.ll b/test/Analysis/LazyValueAnalysis/lvi-for-ashr.ll
new file mode 100644
index 00000000000..cdc27e4d0b3
--- /dev/null
+++ b/test/Analysis/LazyValueAnalysis/lvi-for-ashr.ll
@@ -0,0 +1,27 @@
+; RUN: opt -correlated-propagation -S %s | FileCheck %s
+; CHECK-LABEL: @test-ashr
+; CHECK: bb_then
+; CHECK: %. = select i1 true, i32 3, i32 2
+define i32 @test-ashr(i32 %c) {
+chk65:
+ %cmp = icmp sgt i32 %c, 65
+ br i1 %cmp, label %return, label %chk0
+
+chk0:
+ %cmp1 = icmp slt i32 %c, 0
+ br i1 %cmp, label %return, label %bb_if
+
+bb_if:
+ %ashr.val = ashr exact i32 %c, 2
+ %cmp2 = icmp sgt i32 %ashr.val, 15
+ br i1 %cmp2, label %bb_then, label %return
+
+bb_then:
+ %cmp3 = icmp eq i32 %ashr.val, 16
+ %. = select i1 %cmp3, i32 3, i32 2
+ br label %return
+
+return:
+ %retval = phi i32 [0, %chk65], [1, %chk0], [%., %bb_then], [4, %bb_if]
+ ret i32 %retval
+}