Skip to content

Commit 1ae1c1f

Browse files
committed
Step 2: Patch cost for strided accesses
1 parent 15c8f0b commit 1ae1c1f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,6 +1657,9 @@ class LoopVectorizationCostModel {
16571657
/// element)
16581658
InstructionCost getUniformMemOpCost(Instruction *I, ElementCount VF);
16591659

1660+
/// The cost computation for strided load/store instruction.
1661+
InstructionCost getStridedLoadStoreCost(Instruction *I, ElementCount VF);
1662+
16601663
/// Estimate the overhead of scalarizing an instruction. This is a
16611664
/// convenience wrapper for the type-based getScalarizationOverhead API.
16621665
InstructionCost getScalarizationOverhead(Instruction *I,
@@ -5825,6 +5828,19 @@ LoopVectorizationCostModel::getInterleaveGroupCost(Instruction *I,
58255828
return Cost;
58265829
}
58275830

5831+
InstructionCost
5832+
LoopVectorizationCostModel::getStridedLoadStoreCost(Instruction *I,
5833+
ElementCount VF) {
5834+
Type *ValTy = getLoadStoreType(I);
5835+
auto *VectorTy = cast<VectorType>(toVectorTy(ValTy, VF));
5836+
const Align Alignment = getLoadStoreAlignment(I);
5837+
const Value *Ptr = getLoadStorePointerOperand(I);
5838+
5839+
return TTI.getStridedMemoryOpCost(I->getOpcode(), VectorTy, Ptr,
5840+
Legal->isMaskRequired(I), Alignment,
5841+
CostKind, I);
5842+
}
5843+
58285844
std::optional<InstructionCost>
58295845
LoopVectorizationCostModel::getReductionPatternCost(Instruction *I,
58305846
ElementCount VF,

0 commit comments

Comments
 (0)