[llvm] [NFC][TTI] Remove default CostKind from TTI::getGEPCost() (PR #218764)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 01:49:52 PDT 2026


================
@@ -300,8 +300,10 @@ Instruction *NaryReassociatePass::tryReassociate(Instruction *I,
 static bool isGEPFoldable(GetElementPtrInst *GEP,
                           const TargetTransformInfo *TTI) {
   SmallVector<const Value *, 4> Indices(GEP->indices());
-  return TTI->getGEPCost(GEP->getSourceElementType(), GEP->getPointerOperand(),
-                         Indices) == TargetTransformInfo::TCC_Free;
+  return TTI->getGEPCost(
+             GEP->getSourceElementType(), GEP->getPointerOperand(), Indices,
+             /*CostKind*/ TTI::TargetCostKind::TCK_SizeAndLatency) ==
----------------
RKSimon wrote:

SizeAndLatency is fine - the problem is that we should force every pass to chose and not accidentally depend on the default.

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


More information about the llvm-commits mailing list