summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Analysis/ValueTracking/knownnonzero-shift.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ValueTracking/knownnonzero-shift.ll b/llvm/test/Analysis/ValueTracking/knownnonzero-shift.ll
new file mode 100644
index 00000000000..e59d19cc2e2
--- /dev/null
+++ b/llvm/test/Analysis/ValueTracking/knownnonzero-shift.ll
@@ -0,0 +1,13 @@
+; RUN: opt -instsimplify -S < %s | FileCheck %s
+
+; CHECK-LABEL: @test
+define i1 @test(i8 %p, i8* %pq) {
+ %q = load i8, i8* %pq, !range !0 ; %q is known nonzero; no known bits
+ %1 = shl i8 %p, %q ; because %q is nonzero, %1[0] is known to be zero.
+ %2 = and i8 %1, 1
+ %x = icmp eq i8 %2, 0
+ ; CHECK: ret i1 true
+ ret i1 %x
+}
+
+!0 = !{ i8 1, i8 5 }
OpenPOWER on IntegriCloud