[llvm] 1a7b7d7 - [NFCI][CodeGen, AArch64] Fix inconsistent TargetCostKind types.

Daniil Fukalov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 10:16:54 PDT 2021


Author: Daniil Fukalov
Date: 2021-09-22T20:15:17+03:00
New Revision: 1a7b7d7ba23232fe27c996e1731da7099859569c

URL: https://github.com/llvm/llvm-project/commit/1a7b7d7ba23232fe27c996e1731da7099859569c
DIFF: https://github.com/llvm/llvm-project/commit/1a7b7d7ba23232fe27c996e1731da7099859569c.diff

LOG: [NFCI][CodeGen, AArch64] Fix inconsistent TargetCostKind types.

The pass uses different cost kinds to estimate "old" and "interleaved" costs:
default cost kind for all targets override `getInterleavedMemoryOpCost()` is
`TCK_SizeAndLatency`. Although at the moment estimated `TCK_Latency` costs are
equal to `TCK_SizeAndLatency`, (so the change is NFC) it may change in future.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D110100

Added: 
    

Modified: 
    llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
index 607f9ffb0f46..09e711b34e6e 100644
--- a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
+++ b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
@@ -1131,6 +1131,7 @@ bool InterleavedLoadCombineImpl::combine(std::list<VectorInfo> &InterleavedLoad,
 
   InstructionCost InterleavedCost;
   InstructionCost InstructionCost = 0;
+  const TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency;
 
   // Get the interleave factor
   unsigned Factor = InterleavedLoad.size();
@@ -1158,8 +1159,7 @@ bool InterleavedLoadCombineImpl::combine(std::list<VectorInfo> &InterleavedLoad,
   // be expected. Also sum the cost of the Instructions beeing left dead.
   for (auto &I : Is) {
     // Compute the old cost
-    InstructionCost +=
-        TTI.getInstructionCost(I, TargetTransformInfo::TCK_Latency);
+    InstructionCost += TTI.getInstructionCost(I, CostKind);
 
     // The final SVIs are allowed not to be dead, all uses will be replaced
     if (SVIs.find(I) != SVIs.end())
@@ -1212,7 +1212,7 @@ bool InterleavedLoadCombineImpl::combine(std::list<VectorInfo> &InterleavedLoad,
     Indices.push_back(i);
   InterleavedCost = TTI.getInterleavedMemoryOpCost(
       Instruction::Load, ILTy, Factor, Indices, InsertionPoint->getAlign(),
-      InsertionPoint->getPointerAddressSpace());
+      InsertionPoint->getPointerAddressSpace(), CostKind);
 
   if (InterleavedCost >= InstructionCost) {
     return false;


        


More information about the llvm-commits mailing list