[llvm] [LoopVectorize] Vectorize fixed-order recurrence with vscale x 1. (PR #142772)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 04:24:20 PDT 2025


================
@@ -8652,6 +8651,12 @@ static void addExitUsersForFirstOrderRecurrences(
     for (VPIRInstruction *ExitIRI : ExitUsersToFix) {
       if (ExitIRI->getOperand(0) != FOR)
         continue;
+      // For VF vscale x 1, if vscale = 1, we are unable to extract the
+      // penultimate value of the recurrence. Instead, we can extract the last
+      // element directly from VPInstruction::FirstOrderRecurrenceSplice.
----------------
ayalz wrote:

Sounds somewhat similar to noted (exactly a year ago) in 
https://github.com/llvm/llvm-project/pull/93396#discussion_r1625882431 - would replacing ExtractPenultimate with a suitable ExtractLast work well for all targets?

As noted in https://github.com/llvm/llvm-project/pull/137030#discussion_r2059765886, 
extract penultimate works for VF=1 as well - by extracting penultimate part which is hooked-up when unrolling-by-UF.

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


More information about the llvm-commits mailing list