[llvm] [LV] Strip outdated code in cost-model-matching (PR #154935)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 22 05:21:07 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Ramkumar Ramachandra (artagnon)
<details>
<summary>Changes</summary>
Since c97c686 ([VPlan] Allow folding not (cmp eq) -> icmp ne with other select users), the code is no longer needed.
---
Full diff: https://github.com/llvm/llvm-project/pull/154935.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (-20)
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c4110582da1ef..888437bf42b23 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6953,15 +6953,6 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
VPCostContext &CostCtx,
Loop *TheLoop,
ElementCount VF) {
- // First collect all instructions for the recipes in Plan.
- auto GetInstructionForCost = [](const VPRecipeBase *R) -> Instruction * {
- if (auto *S = dyn_cast<VPSingleDefRecipe>(R))
- return dyn_cast_or_null<Instruction>(S->getUnderlyingValue());
- if (auto *WidenMem = dyn_cast<VPWidenMemoryRecipe>(R))
- return &WidenMem->getIngredient();
- return nullptr;
- };
-
DenseSet<Instruction *> SeenInstrs;
auto Iter = vp_depth_first_deep(Plan.getVectorLoopRegion()->getEntry());
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(Iter)) {
@@ -6999,17 +6990,6 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
RepR->getUnderlyingInstr(), VF))
return true;
}
- if (Instruction *UI = GetInstructionForCost(&R)) {
- // If we adjusted the predicate of the recipe, the cost in the legacy
- // cost model may be different.
- if (auto *WidenCmp = dyn_cast<VPWidenRecipe>(&R)) {
- if ((WidenCmp->getOpcode() == Instruction::ICmp ||
- WidenCmp->getOpcode() == Instruction::FCmp) &&
- WidenCmp->getPredicate() != cast<CmpInst>(UI)->getPredicate())
- return true;
- }
- SeenInstrs.insert(UI);
- }
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/154935
More information about the llvm-commits
mailing list