summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-11 04:09:09 +0000
committerChris Lattner <sabre@nondot.org>2008-07-11 04:09:09 +0000
commit4fa8bb343016b2f5913128c473a614bc5fd289f0 (patch)
tree374ffe40656a5e20e653d72c7e21441bc53e4f6e /llvm/test/Transforms
parent1be09d9e2124d5b0d015f23495c1bd1bb0437b28 (diff)
downloadbcm5719-llvm-4fa8bb343016b2f5913128c473a614bc5fd289f0.tar.gz
bcm5719-llvm-4fa8bb343016b2f5913128c473a614bc5fd289f0.zip
Fix a bogus optimization: folding (slt (zext i1 A to i32), 1) -> (slt i1 A, true)
This cause a regression in InstCombine/JavaCompare, which was doing the right thing on accident. To handle the missed case, generalize the comparisons based on masked bits a little bit to handle comparisons against the max value. For example, we can now xform (slt i32 (and X, 4), 4) -> (setne i32 (and X, 4), 4) llvm-svn: 53443
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll b/llvm/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll
new file mode 100644
index 00000000000..f5efefb0a0b
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll
@@ -0,0 +1,8 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {%C = xor i1 %A, true}
+; PR2539
+
+define i1 @test(i1 %A) {
+ %B = zext i1 %A to i32
+ %C = icmp slt i32 %B, 1
+ ret i1 %C
+}
OpenPOWER on IntegriCloud