[llvm] [LV] Strip outdated code in cost-model-matching (PR #154935)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 05:20:38 PDT 2025


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/154935

Since c97c686 ([VPlan] Allow folding not (cmp eq) -> icmp ne with other select users), the code is no longer needed.

>From c60530ef7c95a5d5ec5e5530906ef35675daadde Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Fri, 22 Aug 2025 13:12:52 +0100
Subject: [PATCH] [LV] Strip outdated code in cost-model-matching

Since c97c686 ([VPlan] Allow folding not (cmp eq) -> icmp ne with other
select users), the code is no longer needed.
---
 .../Transforms/Vectorize/LoopVectorize.cpp    | 20 -------------------
 1 file changed, 20 deletions(-)

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);
-      }
     }
   }
 



More information about the llvm-commits mailing list