[llvm] 54c6a59 - [VectorCombine] Add explicit CostKind to all getMemoryOpCost calls. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 05:39:32 PST 2024


Author: Simon Pilgrim
Date: 2024-12-09T13:39:19Z
New Revision: 54c6a592a078d0a2d484f8a64ac0f1ed47f79e35

URL: https://github.com/llvm/llvm-project/commit/54c6a592a078d0a2d484f8a64ac0f1ed47f79e35
DIFF: https://github.com/llvm/llvm-project/commit/54c6a592a078d0a2d484f8a64ac0f1ed47f79e35.diff

LOG: [VectorCombine] Add explicit CostKind to all getMemoryOpCost calls. NFC.

We currently hardwire CostKind to TTI::TCK_RecipThroughput which matches the default CostKind for getMemoryOpCost.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 06f4575c8b6395..ebbd05e6d47afc 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -249,7 +249,7 @@ bool VectorCombine::vectorizeLoadInsert(Instruction &I) {
   Type *LoadTy = Load->getType();
   unsigned AS = Load->getPointerAddressSpace();
   InstructionCost OldCost =
-      TTI.getMemoryOpCost(Instruction::Load, LoadTy, Alignment, AS);
+      TTI.getMemoryOpCost(Instruction::Load, LoadTy, Alignment, AS, CostKind);
   APInt DemandedElts = APInt::getOneBitSet(MinVecNumElts, 0);
   OldCost +=
       TTI.getScalarizationOverhead(MinVecTy, DemandedElts,
@@ -257,7 +257,7 @@ bool VectorCombine::vectorizeLoadInsert(Instruction &I) {
 
   // New pattern: load VecPtr
   InstructionCost NewCost =
-      TTI.getMemoryOpCost(Instruction::Load, MinVecTy, Alignment, AS);
+      TTI.getMemoryOpCost(Instruction::Load, MinVecTy, Alignment, AS, CostKind);
   // Optionally, we are shuffling the loaded vector element(s) into place.
   // For the mask set everything but element 0 to undef to prevent poison from
   // propagating from the extra loaded memory. This will also optionally
@@ -1341,7 +1341,7 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
 
   InstructionCost OriginalCost =
       TTI.getMemoryOpCost(Instruction::Load, VecTy, LI->getAlign(),
-                          LI->getPointerAddressSpace());
+                          LI->getPointerAddressSpace(), CostKind);
   InstructionCost ScalarizedCost = 0;
 
   Instruction *LastCheckedInst = LI;
@@ -1389,7 +1389,7 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) {
                                Index ? Index->getZExtValue() : -1);
     ScalarizedCost +=
         TTI.getMemoryOpCost(Instruction::Load, VecTy->getElementType(),
-                            Align(1), LI->getPointerAddressSpace());
+                            Align(1), LI->getPointerAddressSpace(), CostKind);
     ScalarizedCost += TTI.getAddressComputationCost(VecTy->getElementType());
   }
 


        


More information about the llvm-commits mailing list