summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-03-27 17:44:52 +0000
committerChad Rosier <mcrosier@apple.com>2012-03-27 17:44:52 +0000
commitd23a64cc164529739adaedb397e6279269f78efb (patch)
treed86a97ed65b407a85a4b110330d364770de0be8d /test
parent805543068eb7407d718b0359f54b342d7094d0ea (diff)
downloadllvm-d23a64cc164529739adaedb397e6279269f78efb.tar.gz
llvm-d23a64cc164529739adaedb397e6279269f78efb.tar.bz2
llvm-d23a64cc164529739adaedb397e6279269f78efb.tar.xz
Reapply r153423; the original commit was fine. The failing test, distray, had
undefined behavior, which Rafael was kind enough to fix. Original commit message for r153423: Use the new range metadata in computeMaskedBits and add a new optimization to instruction simplify that lets us remove an and when loding a boolean value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153521 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstSimplify/pr12251.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/pr12251.ll b/test/Transforms/InstSimplify/pr12251.ll
new file mode 100644
index 0000000000..f180f9f1eb
--- /dev/null
+++ b/test/Transforms/InstSimplify/pr12251.ll
@@ -0,0 +1,15 @@
+; RUN: opt < %s -instsimplify -S | FileCheck %s
+
+define zeroext i1 @_Z3fooPb(i8* nocapture %x) {
+entry:
+ %a = load i8* %x, align 1, !range !0
+ %b = and i8 %a, 1
+ %tobool = icmp ne i8 %b, 0
+ ret i1 %tobool
+}
+
+; CHECK: %a = load i8* %x, align 1, !range !0
+; CHECK-NEXT: %tobool = icmp ne i8 %a, 0
+; CHECK-NEXT: ret i1 %tobool
+
+!0 = metadata !{i8 0, i8 2}