Skip to content

Commit 0f80a7c

Browse files
committed
[SLP][REVEC] Make getAltInstrMask support vector instructions.
Fix "Mask and VecTy are incompatible" from LLVM :: Transforms/SLPVectorizer/X86/cmp_commute-inseltpoison.ll LLVM :: Transforms/SLPVectorizer/X86/cmp_commute.ll LLVM :: Transforms/SLPVectorizer/X86/splat-buildvector.ll
1 parent 177ce19 commit 0f80a7c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,10 +1032,13 @@ static void fixupOrderingIndices(MutableArrayRef<unsigned> Order) {
10321032
/// Opcode1.
10331033
SmallBitVector getAltInstrMask(ArrayRef<Value *> VL, unsigned Opcode0,
10341034
unsigned Opcode1) {
1035-
SmallBitVector OpcodeMask(VL.size(), false);
1035+
Type *ScalarTy = VL[0]->getType();
1036+
unsigned ScalarTyNumElements = getNumElements(ScalarTy);
1037+
SmallBitVector OpcodeMask(VL.size() * ScalarTyNumElements, false);
10361038
for (unsigned Lane : seq<unsigned>(VL.size()))
10371039
if (cast<Instruction>(VL[Lane])->getOpcode() == Opcode1)
1038-
OpcodeMask.set(Lane);
1040+
for (unsigned I = 0; I != ScalarTyNumElements; ++I)
1041+
OpcodeMask.set(Lane * ScalarTyNumElements + I);
10391042
return OpcodeMask;
10401043
}
10411044

0 commit comments

Comments
 (0)