[llvm] [LV] Implement integer part of VPDerivedIV cost model (PR #198252)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 03:09:03 PDT 2026
================
@@ -2797,6 +2797,86 @@ bool VPWidenIntOrFpInductionRecipe::isCanonical() const {
getScalarType() == getRegion()->getCanonicalIVType();
}
+InstructionCost VPDerivedIVRecipe::computeCost(ElementCount VF,
+ VPCostContext &Ctx) const {
+ // The cost model for this is modelled on expandVPDerivedIV in
+ // VPlanTransforms.cpp. In order to avoid overly pessimistic costs that can
+ // negatively affect vectorization it takes into account any expected
+ // simplifications that happen in simplifyRecipe.
+ switch (getInductionKind()) {
+ default:
+ // TODO: Compute cost for remaining kinds.
+ break;
+ case InductionDescriptor::IK_IntInduction: {
+ // There are currently no tests that expose a path where all lanes are
+ // used, so it's better to bail out for now.
+ if (!vputils::onlyFirstLaneUsed(this))
+ break;
----------------
david-arm wrote:
Hi, if the patch doesn't get reverted I'll follow up with these review comments!
https://github.com/llvm/llvm-project/pull/198252
More information about the llvm-commits
mailing list