summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Analysis/ValueTracking/knownzero-shift.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ValueTracking/knownzero-shift.ll b/llvm/test/Analysis/ValueTracking/knownzero-shift.ll
new file mode 100644
index 00000000000..835d87a9d9c
--- /dev/null
+++ b/llvm/test/Analysis/ValueTracking/knownzero-shift.ll
@@ -0,0 +1,14 @@
+; 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 = or i8 %p, 2 ; %1[1] = 1
+ %2 = and i8 %1, 254 ; %2[0] = 0, %2[1] = 1
+ %A = lshr i8 %2, 1 ; We should know that %A is nonzero.
+ %x = icmp eq i8 %A, 0
+ ; CHECK: ret i1 false
+ ret i1 %x
+}
+
+!0 = !{ i8 1, i8 5 }
OpenPOWER on IntegriCloud