[llvm] [LV] Separate runtime check cost from total overhead in profitability check (PR #176754)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 02:57:27 PST 2026


================
@@ -9205,6 +9199,12 @@ static bool isOutsideLoopWorkProfitable(GeneratedRTChecks &Checks,
   if (ScalarC == 0)
     return true;
 
+  InstructionCost TotalCost = RtC;
+  // Add on the cost of any work required in the vector early exit block, if
+  // one exists.
+  TotalCost += calculateEarlyExitCost(CostCtx, Plan, VF.Width);
+  TotalCost += Plan.getMiddleBlock()->cost(VF.Width, CostCtx);
----------------
lukel97 wrote:

Not for this PR, but do we ever check that the early exit/middle block costs aren't invalid?

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


More information about the llvm-commits mailing list