[PATCH] D81013: [InstCombine] move vector select ahead of select-shuffle

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 14:23:46 PDT 2020


lebedev.ri added a comment.

In D81013#2074721 <https://reviews.llvm.org/D81013#2074721>, @spatel wrote:

> In D81013#2074708 <https://reviews.llvm.org/D81013#2074708>, @lebedev.ri wrote:
>
> > Ah, i guess i see it.
> >  The problem is that `ShuffleVectorInst::isSingleSourceMask(ArrayRef<int> Mask)` is kinda broken:
> >  it can't tell `isSingleSourceMaskImpl()` how many src elts there are,
> >  so naturally it will immediately assert as long as it selects from non-first source..
>
>
> Would this be fixed with "cast<ShuffleVectorInst>(TVal)->isSelect()" instead of the mask check?


I think so.

> Let me know if I should revert or if we have a test case to work on.

This should do the trick, but my `opt` is out-of-date to check

  define <5 x i8> @widening(<4 x i8> %x, <4 x i8> %y, <5 x i8> %x2, <5 x i1> %cmp) {
    %blend = shufflevector <4 x i8> %x, <4 x i8> %y, <5 x i32> <i32 0, i32 5, i32 2, i32 7, i32 7>
    %r = select <5 x i1> %cmp, <5 x i8> %blend, <5 x i8> %x2
    ret <5 x i8> %r
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81013/new/

https://reviews.llvm.org/D81013





More information about the llvm-commits mailing list