[llvm] [LoopVectorize] Further improve cost model for early exit loops (PR #126235)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 01:34:49 PST 2025


================
@@ -10564,12 +10591,17 @@ bool LoopVectorizePass::processLoop(Loop *L) {
     if (VF.Width.isVector() || SelectedIC > 1)
       Checks.create(L, *LVL.getLAI(), PSE.getPredicate(), VF.Width, SelectedIC);
 
+    InstructionCost EarlyExitCost = InstructionCost::getInvalid();
+    if (VF.Width.isVector() && LVL.hasUncountableEarlyExit())
+      EarlyExitCost =
+          calculateEarlyExitCost(CM, LVP.getPlanFor(VF.Width), VF.Width);
----------------
david-arm wrote:

Done

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


More information about the llvm-commits mailing list