[llvm] [LV] Simplify live-out extraction for first-order recurrence phis when tail folding (PR #176108)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 16 06:54:03 PST 2026


================
@@ -8575,7 +8575,8 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
 
   // TODO: We can't call runPass on these transforms yet, due to verifier
   // failures.
-  VPlanTransforms::addExitUsersForFirstOrderRecurrences(*Plan, Range);
+  if (!CM.foldTailByMasking())
+    VPlanTransforms::addExitUsersForFirstOrderRecurrences(*Plan, Range);
----------------
ayalz wrote:

+1 for a common simple treatment of FOR exit users for all cases - regardless of vscale 1 or tail-folding, extracting the last lane of the spliced value rather than the penultimate lane of its (second) operand, as noted back in https://github.com/llvm/llvm-project/pull/142772#discussion_r2128590474 which referred to
https://github.com/llvm/llvm-project/pull/93396#discussion_r1625882431
`s_penultimate = v2(2) = v3(3)` wrt the example documented in addExitUsersForFirstOrderRecurrences().

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


More information about the llvm-commits mailing list