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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 11 02:39:16 PST 2025


================
@@ -712,6 +716,25 @@ RecurrenceDescriptor::isFindIVPattern(RecurKind Kind, Loop *TheLoop,
                                      m_Value(NonRdxPhi)))))
     return InstDesc(false, I);
 
+  if (isFindLastRecurrenceKind(Kind)) {
+    // Must be an integer scalar.
+    Type *Type = OrigPhi->getType();
+    if (!Type->isIntegerTy())
+      return InstDesc(false, I);
+
+    // FIXME: Support more complex patterns, including multiple selects.
+    // The Select must be used only outside the loop and by the PHI.
+    for (User *U : I->users()) {
+      if (U == OrigPhi)
+        continue;
+      if (auto *UI = dyn_cast<Instruction>(U); UI && !TheLoop->contains(UI))
----------------
fhahn wrote:

I think we generally avoid this kind of pattern in LV/IVDesc.

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


More information about the llvm-commits mailing list