[llvm] [LV] Support conditional scalar assignments of masked operations (PR #178862)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 5 06:25:14 PST 2026


================
@@ -310,6 +327,13 @@ bool RecurrenceDescriptor::AddReductionVar(
   unsigned NumCmpSelectPatternInst = 0;
   InstDesc ReduxDesc(false, nullptr);
 
+  // To recognize find-lasts of conditional operations (such as loads or
+  // divides), that need masking, we track non-phi users and if we've found a
+  // "find-last-like" phi (see isFindLastLikePhi). We currently only support
+  // loops with a single "find-last-phi" and do not allow any other operations.
----------------
MacDue wrote:

no, per reduction, multiple find-last recurrences are supported in a single loop. There is a test for this in https://github.com/llvm/llvm-test-suite/pull/331 (`multi_csa_with_cond_arith`), which is vectorized with this patch. 

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


More information about the llvm-commits mailing list