summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/bit-checks.ll
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-07-15 15:00:23 +0000
committerOwen Anderson <resistor@mac.com>2010-07-15 15:00:23 +0000
commit7151dfd48a6950ef2cf74485819096b52e303abd (patch)
tree6426f1ba5cd0e3b165ff264ee9b3500d24957ab7 /llvm/test/Transforms/InstCombine/bit-checks.ll
parent26ec65ac3cfcdf27962d78137e72a0cb625532b8 (diff)
downloadbcm5719-llvm-7151dfd48a6950ef2cf74485819096b52e303abd.tar.gz
bcm5719-llvm-7151dfd48a6950ef2cf74485819096b52e303abd.zip
Reapply r108378, with bugfixes, testcase, and improved comment formatting.
This now passes LIT, nighty test, and llvm-gcc bootstrap on my machine. llvm-svn: 108422
Diffstat (limited to 'llvm/test/Transforms/InstCombine/bit-checks.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/bit-checks.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/bit-checks.ll b/llvm/test/Transforms/InstCombine/bit-checks.ll
new file mode 100644
index 00000000000..f97fb45af16
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/bit-checks.ll
@@ -0,0 +1,15 @@
+; This test makes sure that these instructions are properly eliminated.
+;
+; RUN: opt < %s -instcombine -S | \
+; RUN: not grep {tobool}
+; END.
+define i32 @main(i32 %argc, i8** %argv) nounwind ssp {
+entry:
+ %and = and i32 %argc, 1 ; <i32> [#uses=1]
+ %tobool = icmp ne i32 %and, 0 ; <i1> [#uses=1]
+ %and2 = and i32 %argc, 2 ; <i32> [#uses=1]
+ %tobool3 = icmp ne i32 %and2, 0 ; <i1> [#uses=1]
+ %or.cond = and i1 %tobool, %tobool3 ; <i1> [#uses=1]
+ %retval.0 = select i1 %or.cond, i32 2, i32 1 ; <i32> [#uses=1]
+ ret i32 %retval.0
+}
OpenPOWER on IntegriCloud