diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-11 04:09:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-11 04:09:09 +0000 |
commit | f299184565f5f0ff9e3bbb94dad184fd5a690c2c (patch) | |
tree | 6e7e3a00f3dba4245e3c4c764919a65195c81bd5 /test/Transforms/InstCombine | |
parent | 99672cb13061227d182b5b515a7f02ea4d42d4cb (diff) | |
download | llvm-f299184565f5f0ff9e3bbb94dad184fd5a690c2c.tar.gz llvm-f299184565f5f0ff9e3bbb94dad184fd5a690c2c.tar.bz2 llvm-f299184565f5f0ff9e3bbb94dad184fd5a690c2c.tar.xz |
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)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53443 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r-- | test/Transforms/InstCombine/2008-07-10-CastSextBool.ll | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll b/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll new file mode 100644 index 0000000000..f5efefb0a0 --- /dev/null +++ b/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 +} |