Skip to content

Commit d7354e3

Browse files
authored
[SLP][REVEC] Fix ShuffleVector does not consider alternate instruction. (#134599)
1 parent 99d12ac commit d7354e3

File tree

2 files changed

+169
-26
lines changed

2 files changed

+169
-26
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17770,13 +17770,12 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
1777017770
Value *Src = vectorizeOperand(E, 0);
1777117771
SmallVector<int> ThisMask(calculateShufflevectorMask(E->Scalars));
1777217772
if (auto *SVSrc = dyn_cast<ShuffleVectorInst>(Src)) {
17773-
assert(isa<PoisonValue>(SVSrc->getOperand(1)) &&
17774-
"Not supported shufflevector usage.");
1777517773
SmallVector<int> NewMask(ThisMask.size());
1777617774
transform(ThisMask, NewMask.begin(), [&SVSrc](int Mask) {
1777717775
return SVSrc->getShuffleMask()[Mask];
1777817776
});
17779-
V = Builder.CreateShuffleVector(SVSrc->getOperand(0), NewMask);
17777+
V = Builder.CreateShuffleVector(SVSrc->getOperand(0),
17778+
SVSrc->getOperand(1), NewMask);
1778017779
} else {
1778117780
V = Builder.CreateShuffleVector(Src, ThisMask);
1778217781
}

0 commit comments

Comments
 (0)