Skip to content

Commit 761040e

Browse files
committed
[SLP][REVEC] DO not break MinBWs flow.
1 parent a498331 commit 761040e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12581,8 +12581,15 @@ Value *BoUpSLP::vectorizeOperand(TreeEntry *E, unsigned NodeIdx,
1258112581
}
1258212582
if (IsSameVE) {
1258312583
auto FinalShuffle = [&](Value *V, ArrayRef<int> Mask) {
12584-
ShuffleInstructionBuilder ShuffleBuilder(VL.front()->getType(), Builder,
12585-
*this);
12584+
// V may be affected by MinBWs.
12585+
// We want ShuffleInstructionBuilder to correctly support REVEC. The key
12586+
// factor is the number of elements, not their type.
12587+
Type *ScalarTy = cast<VectorType>(V->getType())->getElementType();
12588+
unsigned NumElements = getNumElements(VL.front()->getType());
12589+
ShuffleInstructionBuilder ShuffleBuilder(
12590+
NumElements != 1 ? FixedVectorType::get(ScalarTy, NumElements)
12591+
: ScalarTy,
12592+
Builder, *this);
1258612593
ShuffleBuilder.add(V, Mask);
1258712594
return ShuffleBuilder.finalize(std::nullopt);
1258812595
};

0 commit comments

Comments
 (0)