[llvm] [SLP]Add GEP cost estimation for gathered loads. (PR #80867)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 10:54:48 PST 2024


================
@@ -7170,14 +7170,43 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
               TTI.getMemoryOpCost(Instruction::Load, LoadTy, Alignment,
                                   LI->getPointerAddressSpace(), CostKind,
                                   TTI::OperandValueInfo(), LI);
+          // Estimate GEP cost.
+          SmallVector<Value *> PointerOps(VF);
+          for (auto [I, V] : enumerate(VL.slice(P, VF)))
+            PointerOps[I] = cast<LoadInst>(V)->getPointerOperand();
+          InstructionCost ScalarGEPCost;
+          InstructionCost VectorGEPCost;
+          std::tie(ScalarGEPCost, VectorGEPCost) =
----------------
preames wrote:

You should be able to use:
auto [ScalarGEPCost, VectorGEPCost] = 

i.e. avoid forward declare and tie.

https://github.com/llvm/llvm-project/pull/80867


More information about the llvm-commits mailing list