[TargetLowering] fix isConstTrueVal to account for build vector truncation
authorSanjay Patel <spatel@rotateright.com>
Wed, 26 Apr 2017 14:05:42 +0000 (14:05 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 26 Apr 2017 14:05:42 +0000 (14:05 +0000)
commite2ec05a62a4d14918d828294b219a909dc07bcb5
tree927abe212f3b976a9a718446a3f9186148b04621
parent62aee14978dc02951cf2cc245bb7b0a8a7149fe4
[TargetLowering] fix isConstTrueVal to account for build vector truncation

Build vectors have magical truncation powers, so we have things like this:

v4i1 = BUILD_VECTOR Constant:i32<1>, Constant:i32<1>, Constant:i32<1>, Constant:i32<1>
v4i16 = BUILD_VECTOR Constant:i32<1>, Constant:i32<1>, Constant:i32<1>, Constant:i32<1>

If we don't truncate the splat node returned by getConstantSplatNode(), then we won't find
truth when ZeroOrNegativeOneBooleanContent is the rule.

Differential Revision: https://reviews.llvm.org/D32505

llvm-svn: 301408
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/X86/setcc-combine.ll