@@ -2891,6 +2891,7 @@ class BoUpSLP {
28912891 OpsVec[OpIdx][Lane] = {Operands[OpIdx][Lane], true, false};
28922892 continue;
28932893 }
2894+ assert(I && "Expected instruction");
28942895 auto [SelectedOp, Ops] = convertTo(I, S);
28952896 bool IsInverseOperation = !isCommutative(SelectedOp);
28962897 for (unsigned OpIdx : seq<unsigned>(ArgSize)) {
@@ -9893,11 +9894,6 @@ class InstructionsCompatibilityAnalysis {
98939894 const TargetLibraryInfo &TLI)
98949895 : DT(DT), DL(DL), TTI(TTI), TLI(TLI) {}
98959896
9896- InstructionsState buildInstructionsState(ArrayRef<Value *> VL) {
9897- InstructionsState S = getSameOpcode(VL, TLI);
9898- return S;
9899- }
9900-
99019897 SmallVector<BoUpSLP::ValueList> buildOperands(const InstructionsState &S,
99029898 ArrayRef<Value *> VL) {
99039899 assert(S && "Invalid state!");
@@ -9915,10 +9911,9 @@ bool BoUpSLP::isLegalToVectorizeScalars(ArrayRef<Value *> VL, unsigned Depth,
99159911 bool &TrySplitVectorize) const {
99169912 assert((allConstant(VL) || allSameType(VL)) && "Invalid types!");
99179913
9914+ S = getSameOpcode(VL, *TLI);
99189915 TryToFindDuplicates = true;
99199916 TrySplitVectorize = false;
9920- InstructionsCompatibilityAnalysis Analysis(*DT, *DL, *TTI, *TLI);
9921- S = Analysis.buildInstructionsState(VL);
99229917
99239918 // Don't go into catchswitch blocks, which can happen with PHIs.
99249919 // Such blocks can only have PHIs and the catchswitch. There is no
@@ -12878,8 +12873,7 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
1287812873const BoUpSLP::TreeEntry *BoUpSLP::getOperandEntry(const TreeEntry *E,
1287912874 unsigned Idx) const {
1288012875 ArrayRef<Value *> VL = E->getOperand(Idx);
12881- InstructionsCompatibilityAnalysis Analysis(*DT, *DL, *TTI, *TLI);
12882- InstructionsState S = Analysis.buildInstructionsState(VL);
12876+ InstructionsState S = getSameOpcode(VL, *TLI);
1288312877 // Special processing for GEPs bundle, which may include non-gep values.
1288412878 if (!S && VL.front()->getType()->isPointerTy()) {
1288512879 const auto *It = find_if(VL, IsaPred<GetElementPtrInst>);
@@ -16892,8 +16886,7 @@ BoUpSLP::getMatchedVectorizedOperand(const TreeEntry *E, unsigned NodeIdx,
1689216886
1689316887Value *BoUpSLP::vectorizeOperand(TreeEntry *E, unsigned NodeIdx) {
1689416888 ValueList &VL = E->getOperand(NodeIdx);
16895- InstructionsCompatibilityAnalysis Analysis(*DT, *DL, *TTI, *TLI);
16896- InstructionsState S = Analysis.buildInstructionsState(VL);
16889+ InstructionsState S = getSameOpcode(VL, *TLI);
1689716890 // Special processing for GEPs bundle, which may include non-gep values.
1689816891 if (!S && VL.front()->getType()->isPointerTy()) {
1689916892 const auto *It = find_if(VL, IsaPred<GetElementPtrInst>);
@@ -20990,8 +20983,7 @@ SLPVectorizerPass::vectorizeStoreChain(ArrayRef<Value *> Chain, BoUpSLP &R,
2099020983 for (Value *V : Chain)
2099120984 ValOps.insert(cast<StoreInst>(V)->getValueOperand());
2099220985 // Operands are not same/alt opcodes or non-power-of-2 uniques - exit.
20993- InstructionsCompatibilityAnalysis Analysis(*DT, *DL, *TTI, *TLI);
20994- InstructionsState S = Analysis.buildInstructionsState(ValOps.getArrayRef());
20986+ InstructionsState S = getSameOpcode(ValOps.getArrayRef(), *TLI);
2099520987 if (all_of(ValOps, IsaPred<Instruction>) && ValOps.size() > 1) {
2099620988 DenseSet<Value *> Stores(Chain.begin(), Chain.end());
2099720989 bool IsAllowedSize =
0 commit comments