@@ -7090,8 +7090,8 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
7090
7090
!all_of(Gathers, [&](Value *V) { return R.getTreeEntry(V); }) &&
7091
7091
!isSplat(Gathers)) {
7092
7092
SetVector<Value *> VectorizedLoads;
7093
- SmallVector<LoadInst * > VectorizedStarts;
7094
- SmallVector<std::pair< unsigned, unsigned> > ScatterVectorized;
7093
+ SmallVector<unsigned > VectorizedStarts;
7094
+ SmallVector<unsigned> ScatterVectorized;
7095
7095
unsigned StartIdx = 0;
7096
7096
unsigned VF = VL.size() / 2;
7097
7097
for (; VF >= MinVF; VF /= 2) {
@@ -7119,9 +7119,9 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
7119
7119
// again.
7120
7120
// TODO: better handling of loads with reorders.
7121
7121
if (LS == LoadsState::Vectorize && CurrentOrder.empty())
7122
- VectorizedStarts.push_back(cast<LoadInst>(Slice.front()) );
7122
+ VectorizedStarts.push_back(Cnt );
7123
7123
else
7124
- ScatterVectorized.emplace_back (Cnt, VF );
7124
+ ScatterVectorized.push_back (Cnt);
7125
7125
VectorizedLoads.insert(Slice.begin(), Slice.end());
7126
7126
// If we vectorized initial block, no need to try to vectorize
7127
7127
// it again.
@@ -7163,17 +7163,18 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
7163
7163
CostKind, TTI::OperandValueInfo(), LI);
7164
7164
}
7165
7165
auto *LoadTy = FixedVectorType::get(VL.front()->getType(), VF);
7166
- for (LoadInst *LI : VectorizedStarts) {
7166
+ for (unsigned P : VectorizedStarts) {
7167
+ auto *LI = cast<LoadInst>(VL[P]);
7167
7168
Align Alignment = LI->getAlign();
7168
7169
GatherCost +=
7169
7170
TTI.getMemoryOpCost(Instruction::Load, LoadTy, Alignment,
7170
7171
LI->getPointerAddressSpace(), CostKind,
7171
7172
TTI::OperandValueInfo(), LI);
7172
7173
}
7173
- for (std::pair< unsigned, unsigned> P : ScatterVectorized) {
7174
- auto *LI0 = cast<LoadInst>(VL[P.first ]);
7174
+ for (unsigned P : ScatterVectorized) {
7175
+ auto *LI0 = cast<LoadInst>(VL[P]);
7175
7176
Align CommonAlignment =
7176
- computeCommonAlignment<LoadInst>(VL.slice(P.first + 1 , VF - 1 ));
7177
+ computeCommonAlignment<LoadInst>(VL.slice(P, VF));
7177
7178
GatherCost += TTI.getGatherScatterOpCost(
7178
7179
Instruction::Load, LoadTy, LI0->getPointerOperand(),
7179
7180
/*VariableMask=*/false, CommonAlignment, CostKind, LI0);
0 commit comments