[llvm] [LV] Vectorize conditional scalar assignments (PR #158088)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 5 02:12:16 PST 2025


================
@@ -721,9 +723,15 @@ RecurrenceDescriptor::isAnyOfPattern(Loop *Loop, PHINode *OrigPhi,
 //     if (src[i] > 3)
 //       r = i;
 //   }
+// or like this:
+//   int r = 0;
+//   for (int i = 0; i < n; i++) {
+//     if (src[i] > 3)
+//       r = src[i];
+//   }
 // The reduction value (r) is derived from either the values of an induction
-// variable (i) sequence, or from the start value (0). The LLVM IR generated for
-// such loops would be as follows:
+// variable (i) sequence, an arbitrary value (a[i]), or from the start value
----------------
fhahn wrote:

```suggestion
// variable (i) sequence, an arbitrary value (src[i]), or from the start value
```

(or the more generic term if updated above)

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


More information about the llvm-commits mailing list