[llvm] [LV] Support conditional scalar assignments of masked operations (PR #178862)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 5 02:33:16 PST 2026
================
@@ -473,9 +499,17 @@ bool RecurrenceDescriptor::AddReductionVar(
!isAnyOfRecurrenceKind(Kind) && hasMultipleUsesOf(Cur, VisitedInsts, 1))
return false;
- // All inputs to a PHI node must be a reduction value.
- if (IsAPhi && Cur != Phi && !areAllUsesIn(Cur, VisitedInsts))
- return false;
+ if (IsAPhi && Cur != Phi) {
+ if (!areAllUsesIn(Cur, VisitedInsts)) {
+ // A "FindLast-like" Phi acts like a conditional select between the
+ // previous reduction value, and an arbitrary value.
+ FoundFindLastLikePhi =
+ Kind == RecurKind::FindLast && !FoundFindLastLikePhi &&
----------------
sdesmalen-arm wrote:
Thanks for constructing a test for this!
https://github.com/llvm/llvm-project/pull/178862
More information about the llvm-commits
mailing list