Skip to content

Commit ba93ce0

Browse files
committed
use general getScalarizationOverhead
1 parent 91c156b commit ba93ce0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5244,21 +5244,22 @@ BoUpSLP::canVectorizeLoads(ArrayRef<Value *> VL, const Value *VL0,
52445244
// Estimate the cost of masked gather GEP. If not a splat, roughly
52455245
// estimate as a buildvector, otherwise estimate as splat.
52465246
APInt DemandedElts = APInt::getAllOnes(Sz);
5247-
VectorType *PtrVecTy =
5248-
getWidenedType(PointerOps.front()->getType()->getScalarType(), Sz);
5247+
Type *PtrScalarTy = PointerOps.front()->getType()->getScalarType();
5248+
VectorType *PtrVecTy = getWidenedType(PtrScalarTy, Sz);
52495249
if (static_cast<unsigned>(count_if(
52505250
PointerOps, IsaPred<GetElementPtrInst>)) < PointerOps.size() - 1 ||
52515251
any_of(PointerOps, [&](Value *V) {
52525252
return getUnderlyingObject(V) !=
52535253
getUnderlyingObject(PointerOps.front());
52545254
}))
5255-
VectorGEPCost += TTI.getScalarizationOverhead(
5256-
PtrVecTy, DemandedElts, /*Insert=*/true, /*Extract=*/false, CostKind);
5255+
VectorGEPCost += getScalarizationOverhead(TTI, PtrScalarTy, PtrVecTy,
5256+
DemandedElts, /*Insert=*/true,
5257+
/*Extract=*/false, CostKind);
52575258
else
52585259
VectorGEPCost +=
5259-
TTI.getScalarizationOverhead(PtrVecTy, APInt::getOneBitSet(Sz, 0),
5260-
/*Insert=*/true, /*Extract=*/false,
5261-
CostKind) +
5260+
getScalarizationOverhead(
5261+
TTI, PtrScalarTy, PtrVecTy, APInt::getOneBitSet(Sz, 0),
5262+
/*Insert=*/true, /*Extract=*/false, CostKind) +
52625263
::getShuffleCost(TTI, TTI::SK_Broadcast, PtrVecTy, {}, CostKind);
52635264
// The cost of scalar loads.
52645265
InstructionCost ScalarLoadsCost =

0 commit comments

Comments
 (0)