Skip to content

Commit 54c6a59

Browse files
committed
[VectorCombine] Add explicit CostKind to all getMemoryOpCost calls. NFC.
We currently hardwire CostKind to TTI::TCK_RecipThroughput which matches the default CostKind for getMemoryOpCost.
1 parent 0e70e0e commit 54c6a59

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,15 @@ bool VectorCombine::vectorizeLoadInsert(Instruction &I) {
249249
Type *LoadTy = Load->getType();
250250
unsigned AS = Load->getPointerAddressSpace();
251251
InstructionCost OldCost =
252-
TTI.getMemoryOpCost(Instruction::Load, LoadTy, Alignment, AS);
252+
TTI.getMemoryOpCost(Instruction::Load, LoadTy, Alignment, AS, CostKind);
253253
APInt DemandedElts = APInt::getOneBitSet(MinVecNumElts, 0);
254254
OldCost +=
255255
TTI.getScalarizationOverhead(MinVecTy, DemandedElts,
256256
/* Insert */ true, HasExtract, CostKind);
257257

258258
// New pattern: load VecPtr
259259
InstructionCost NewCost =
260-
TTI.getMemoryOpCost(Instruction::Load, MinVecTy, Alignment, AS);
260+
TTI.getMemoryOpCost(Instruction::Load, MinVecTy, Alignment, AS, CostKind);
261261
// Optionally, we are shuffling the loaded vector element(s) into place.
262262
// For the mask set everything but element 0 to undef to prevent poison from
263263
// propagating from the extra loaded memory. This will also optionally
@@ -1341,7 +1341,7 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
13411341

13421342
InstructionCost OriginalCost =
13431343
TTI.getMemoryOpCost(Instruction::Load, VecTy, LI->getAlign(),
1344-
LI->getPointerAddressSpace());
1344+
LI->getPointerAddressSpace(), CostKind);
13451345
InstructionCost ScalarizedCost = 0;
13461346

13471347
Instruction *LastCheckedInst = LI;
@@ -1389,7 +1389,7 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
13891389
Index ? Index->getZExtValue() : -1);
13901390
ScalarizedCost +=
13911391
TTI.getMemoryOpCost(Instruction::Load, VecTy->getElementType(),
1392-
Align(1), LI->getPointerAddressSpace());
1392+
Align(1), LI->getPointerAddressSpace(), CostKind);
13931393
ScalarizedCost += TTI.getAddressComputationCost(VecTy->getElementType());
13941394
}
13951395

0 commit comments

Comments
 (0)