@@ -9217,18 +9217,19 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
9217
9217
// When REVEC is enabled, we need to expand vector types into scalar
9218
9218
// types.
9219
9219
unsigned VecTyNumElements = VecTy->getNumElements();
9220
- SmallVector<Constant *> NewVals;
9221
- NewVals.reserve(VL.size() * VecTyNumElements);
9222
- for (Constant *V : Vals)
9223
- for (unsigned I = 0; I != VecTyNumElements; ++I) {
9224
- Type *ScalarTy = V->getType()->getScalarType();
9225
- if (isa<PoisonValue>(V))
9226
- NewVals.push_back(PoisonValue::get(ScalarTy));
9227
- else if (isa<UndefValue>(V))
9228
- NewVals.push_back(UndefValue::get(ScalarTy));
9229
- else
9230
- NewVals.push_back(Constant::getNullValue(ScalarTy));
9231
- }
9220
+ SmallVector<Constant *> NewVals(VF * VecTyNumElements, nullptr);
9221
+ for (auto [I, V] : enumerate(Vals)) {
9222
+ Type *ScalarTy = V->getType()->getScalarType();
9223
+ Constant *NewVal;
9224
+ if (isa<PoisonValue>(V))
9225
+ NewVal = PoisonValue::get(ScalarTy);
9226
+ else if (isa<UndefValue>(V))
9227
+ NewVal = UndefValue::get(ScalarTy);
9228
+ else
9229
+ NewVal = Constant::getNullValue(ScalarTy);
9230
+ std::fill_n(NewVals.begin() + I * VecTyNumElements, VecTyNumElements,
9231
+ NewVal);
9232
+ }
9232
9233
Vals.swap(NewVals);
9233
9234
}
9234
9235
return ConstantVector::get(Vals);
0 commit comments