[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 17:24:41 PDT 2017


spatel added a comment.

In https://reviews.llvm.org/D32505#737448, @efriedma wrote:

> > I was hoping that ISD::isConstantSplatVector() would have worked here, but it doesn't
>
> I'd rather fix this, unless you think the check is important for some reason.


BuildVectorSDNode::isConstantSplat() is broken for a truncating BV. For the bool vec cases we're seeing here, it's claiming that the splat val is a 4-bit APInt with value 15.

I'm not sure if it should just assert that the input vector has at least byte-sized elements:

  while (VecWidth > 8) {

(it takes endianness as a param too)
or if it needs to take truncation into account.

If I just change that loop check to (VecWidth > 2), we crash several regression tests.
So I'd like to fix it too, but I'd rather not gate this patch on that if that's alright?


https://reviews.llvm.org/D32505





More information about the llvm-commits mailing list