[PATCH] D32505: [TargetLowering] fix isConstTrueVal to account for build vector truncation

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 14:23:20 PDT 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

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.

Note: I was hoping that ISD::isConstantSplatVector() would have worked here, but it doesn't because it has this bitsize check which I don't understand yet:

  return BV->isConstantSplat(SplatVal, SplatUndef, SplatBitSize, HasUndefs) &&
         EltVT.getSizeInBits() >= SplatBitSize;


https://reviews.llvm.org/D32505

Files:
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  test/CodeGen/X86/setcc-combine.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32505.96632.patch
Type: text/x-patch
Size: 3986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170425/cb924b80/attachment.bin>


More information about the llvm-commits mailing list