[llvm] [VPlan] Don't cost FOR splice if unused in legacy cost model (PR #131486)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 16 12:25:06 PDT 2025
================
@@ -6541,6 +6541,11 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
// TODO: Consider vscale_range info.
if (VF.isScalable() && VF.getKnownMinValue() == 1)
return InstructionCost::getInvalid();
+ // If a FOR has no users inside the loop we won't generate a splice.
+ if (none_of(Phi->users(), [this](User *U) {
----------------
fhahn wrote:
This leaves another case where we would crash, e.g. if the first-order recurrence is used by another instruction that can be removed. It may be enough to add a variant of the test where the FOR is used by another binary instruction? Actually, that simplification would already trigger planContainsAdditionalSimplifications.
Could we catch this FOR simplification in planContainsAdditionalSimplifications as well?
https://github.com/llvm/llvm-project/pull/131486
More information about the llvm-commits
mailing list