@@ -1264,9 +1264,8 @@ static void fixupOrderingIndices(MutableArrayRef<unsigned> Order) {
12641264
12651265/// \returns a bitset for selecting opcodes. false for Opcode0 and true for
12661266/// Opcode1.
1267- static SmallBitVector getAltInstrMask(ArrayRef<Value *> VL, unsigned Opcode0,
1268- unsigned Opcode1) {
1269- Type *ScalarTy = VL[0]->getType();
1267+ static SmallBitVector getAltInstrMask(ArrayRef<Value *> VL, Type *ScalarTy,
1268+ unsigned Opcode0, unsigned Opcode1) {
12701269 unsigned ScalarTyNumElements = getNumElements(ScalarTy);
12711270 SmallBitVector OpcodeMask(VL.size() * ScalarTyNumElements, false);
12721271 for (unsigned Lane : seq<unsigned>(VL.size())) {
@@ -6667,11 +6666,12 @@ void BoUpSLP::reorderTopToBottom() {
66676666 // to take into account their order when looking for the most used order.
66686667 if (TE->hasState() && TE->isAltShuffle() &&
66696668 TE->State != TreeEntry::SplitVectorize) {
6670- VectorType *VecTy =
6671- getWidenedType(TE->Scalars[0]->getType() , TE->Scalars.size());
6669+ Type *ScalarTy = TE->Scalars[0]->getType();
6670+ VectorType *VecTy = getWidenedType(ScalarTy , TE->Scalars.size());
66726671 unsigned Opcode0 = TE->getOpcode();
66736672 unsigned Opcode1 = TE->getAltOpcode();
6674- SmallBitVector OpcodeMask(getAltInstrMask(TE->Scalars, Opcode0, Opcode1));
6673+ SmallBitVector OpcodeMask(
6674+ getAltInstrMask(TE->Scalars, ScalarTy, Opcode0, Opcode1));
66756675 // If this pattern is supported by the target then we consider the order.
66766676 if (TTIRef.isLegalAltInstr(VecTy, Opcode0, Opcode1, OpcodeMask)) {
66776677 VFToOrderedEntries[TE->getVectorFactor()].insert(TE.get());
@@ -8352,12 +8352,13 @@ static bool isAlternateInstruction(const Instruction *I,
83528352
83538353bool BoUpSLP::areAltOperandsProfitable(const InstructionsState &S,
83548354 ArrayRef<Value *> VL) const {
8355+ Type *ScalarTy = S.getMainOp()->getType();
83558356 unsigned Opcode0 = S.getOpcode();
83568357 unsigned Opcode1 = S.getAltOpcode();
8357- SmallBitVector OpcodeMask(getAltInstrMask(VL, Opcode0, Opcode1));
8358+ SmallBitVector OpcodeMask(getAltInstrMask(VL, ScalarTy, Opcode0, Opcode1));
83588359 // If this pattern is supported by the target then consider it profitable.
8359- if (TTI->isLegalAltInstr(getWidenedType(S.getMainOp()->getType() , VL.size()),
8360- Opcode0, Opcode1, OpcodeMask))
8360+ if (TTI->isLegalAltInstr(getWidenedType(ScalarTy , VL.size()), Opcode0 ,
8361+ Opcode1, OpcodeMask))
83618362 return true;
83628363 SmallVector<ValueList> Operands;
83638364 for (unsigned I : seq<unsigned>(S.getMainOp()->getNumOperands())) {
@@ -9270,7 +9271,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
92709271 VectorType *VecTy = getWidenedType(ScalarTy, VL.size());
92719272 unsigned Opcode0 = LocalState.getOpcode();
92729273 unsigned Opcode1 = LocalState.getAltOpcode();
9273- SmallBitVector OpcodeMask(getAltInstrMask(VL, Opcode0, Opcode1));
9274+ SmallBitVector OpcodeMask(getAltInstrMask(VL, ScalarTy, Opcode0, Opcode1));
92749275 // Enable split node, only if all nodes do not form legal alternate
92759276 // instruction (like X86 addsub).
92769277 SmallPtrSet<Value *, 4> UOp1(llvm::from_range, Op1);
@@ -13200,7 +13201,8 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
1320013201 // order.
1320113202 unsigned Opcode0 = E->getOpcode();
1320213203 unsigned Opcode1 = E->getAltOpcode();
13203- SmallBitVector OpcodeMask(getAltInstrMask(E->Scalars, Opcode0, Opcode1));
13204+ SmallBitVector OpcodeMask(
13205+ getAltInstrMask(E->Scalars, ScalarTy, Opcode0, Opcode1));
1320413206 // If this pattern is supported by the target then we consider the
1320513207 // order.
1320613208 if (TTIRef.isLegalAltInstr(VecTy, Opcode0, Opcode1, OpcodeMask)) {
0 commit comments