@@ -1264,9 +1264,8 @@ static void fixupOrderingIndices(MutableArrayRef<unsigned> Order) {
1264
1264
1265
1265
/// \returns a bitset for selecting opcodes. false for Opcode0 and true for
1266
1266
/// 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) {
1270
1269
unsigned ScalarTyNumElements = getNumElements(ScalarTy);
1271
1270
SmallBitVector OpcodeMask(VL.size() * ScalarTyNumElements, false);
1272
1271
for (unsigned Lane : seq<unsigned>(VL.size())) {
@@ -6667,11 +6666,12 @@ void BoUpSLP::reorderTopToBottom() {
6667
6666
// to take into account their order when looking for the most used order.
6668
6667
if (TE->hasState() && TE->isAltShuffle() &&
6669
6668
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());
6672
6671
unsigned Opcode0 = TE->getOpcode();
6673
6672
unsigned Opcode1 = TE->getAltOpcode();
6674
- SmallBitVector OpcodeMask(getAltInstrMask(TE->Scalars, Opcode0, Opcode1));
6673
+ SmallBitVector OpcodeMask(
6674
+ getAltInstrMask(TE->Scalars, ScalarTy, Opcode0, Opcode1));
6675
6675
// If this pattern is supported by the target then we consider the order.
6676
6676
if (TTIRef.isLegalAltInstr(VecTy, Opcode0, Opcode1, OpcodeMask)) {
6677
6677
VFToOrderedEntries[TE->getVectorFactor()].insert(TE.get());
@@ -8352,12 +8352,13 @@ static bool isAlternateInstruction(const Instruction *I,
8352
8352
8353
8353
bool BoUpSLP::areAltOperandsProfitable(const InstructionsState &S,
8354
8354
ArrayRef<Value *> VL) const {
8355
+ Type *ScalarTy = S.getMainOp()->getType();
8355
8356
unsigned Opcode0 = S.getOpcode();
8356
8357
unsigned Opcode1 = S.getAltOpcode();
8357
- SmallBitVector OpcodeMask(getAltInstrMask(VL, Opcode0, Opcode1));
8358
+ SmallBitVector OpcodeMask(getAltInstrMask(VL, ScalarTy, Opcode0, Opcode1));
8358
8359
// 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))
8361
8362
return true;
8362
8363
SmallVector<ValueList> Operands;
8363
8364
for (unsigned I : seq<unsigned>(S.getMainOp()->getNumOperands())) {
@@ -9270,7 +9271,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
9270
9271
VectorType *VecTy = getWidenedType(ScalarTy, VL.size());
9271
9272
unsigned Opcode0 = LocalState.getOpcode();
9272
9273
unsigned Opcode1 = LocalState.getAltOpcode();
9273
- SmallBitVector OpcodeMask(getAltInstrMask(VL, Opcode0, Opcode1));
9274
+ SmallBitVector OpcodeMask(getAltInstrMask(VL, ScalarTy, Opcode0, Opcode1));
9274
9275
// Enable split node, only if all nodes do not form legal alternate
9275
9276
// instruction (like X86 addsub).
9276
9277
SmallPtrSet<Value *, 4> UOp1(llvm::from_range, Op1);
@@ -13200,7 +13201,8 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
13200
13201
// order.
13201
13202
unsigned Opcode0 = E->getOpcode();
13202
13203
unsigned Opcode1 = E->getAltOpcode();
13203
- SmallBitVector OpcodeMask(getAltInstrMask(E->Scalars, Opcode0, Opcode1));
13204
+ SmallBitVector OpcodeMask(
13205
+ getAltInstrMask(E->Scalars, ScalarTy, Opcode0, Opcode1));
13204
13206
// If this pattern is supported by the target then we consider the
13205
13207
// order.
13206
13208
if (TTIRef.isLegalAltInstr(VecTy, Opcode0, Opcode1, OpcodeMask)) {
0 commit comments