Fix a bogus optimization: folding (slt (zext i1 A to i32), 1) -> (slt i1 A, true)
authorChris Lattner <sabre@nondot.org>
Fri, 11 Jul 2008 04:09:09 +0000 (04:09 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 11 Jul 2008 04:09:09 +0000 (04:09 +0000)
commitf299184565f5f0ff9e3bbb94dad184fd5a690c2c
tree6e7e3a00f3dba4245e3c4c764919a65195c81bd5
parent99672cb13061227d182b5b515a7f02ea4d42d4cb
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
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/2008-07-10-CastSextBool.ll [new file with mode: 0644]