[llvm] a2c16bb - [VPlan] Rename CondSelect to FindLastSelect (NFC). (#190536)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 09:39:43 PDT 2026


Author: Florian Hahn
Date: 2026-04-05T16:39:34Z
New Revision: a2c16bb59f8f54543f2f89c55e0e7f5f303a43d7

URL: https://github.com/llvm/llvm-project/commit/a2c16bb59f8f54543f2f89c55e0e7f5f303a43d7
DIFF: https://github.com/llvm/llvm-project/commit/a2c16bb59f8f54543f2f89c55e0e7f5f303a43d7.diff

LOG: [VPlan] Rename CondSelect to FindLastSelect (NFC). (#190536)

…ns (NFC).

Use the more descriptive name FindLastSelect for the conditional select
that picks between the reduction phi and the IV value.

Split off from approved
https://github.com/llvm/llvm-project/pull/183911/ as suggested.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 07b8aaa6c8831..d1ec2031adaba 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -5749,21 +5749,21 @@ void VPlanTransforms::optimizeFindIVReductions(VPlan &Plan,
     // If there's a header mask, the backedge select will not be the find-last
     // select.
     VPValue *BackedgeVal = PhiR->getBackedgeValue();
-    VPValue *CondSelect = BackedgeVal;
-    if (HeaderMask &&
-        !match(BackedgeVal, m_Select(m_Specific(HeaderMask),
-                                     m_VPValue(CondSelect), m_Specific(PhiR))))
+    VPValue *FindLastSelect = BackedgeVal;
+    if (HeaderMask && !match(BackedgeVal, m_Select(m_Specific(HeaderMask),
+                                                   m_VPValue(FindLastSelect),
+                                                   m_Specific(PhiR))))
       llvm_unreachable("expected header mask select");
 
-    // Get the IV from the conditional select of the reduction phi.
-    // The conditional select should be a select between the phi and the IV.
+    // Get the IV from the find-last select of the reduction phi.
+    // The find-last select should be a select between the phi and the IV.
     VPValue *Cond, *TrueVal, *FalseVal;
-    if (!match(CondSelect, m_Select(m_VPValue(Cond), m_VPValue(TrueVal),
-                                    m_VPValue(FalseVal))))
+    if (!match(FindLastSelect, m_Select(m_VPValue(Cond), m_VPValue(TrueVal),
+                                        m_VPValue(FalseVal))))
       continue;
 
     // The non-phi operand of the select is the IV.
-    assert(is_contained(CondSelect->getDefiningRecipe()->operands(), PhiR));
+    assert(is_contained(FindLastSelect->getDefiningRecipe()->operands(), PhiR));
     VPValue *IV = TrueVal == PhiR ? FalseVal : TrueVal;
 
     const SCEV *IVSCEV = vputils::getSCEVExprForVPValue(IV, PSE, &L);
@@ -5855,7 +5855,8 @@ void VPlanTransforms::optimizeFindIVReductions(VPlan &Plan,
 
     auto *NewPhiR = new VPReductionPHIRecipe(
         cast<PHINode>(PhiR->getUnderlyingInstr()), RecurKind::FindIV, *StartVPV,
-        *CondSelect, RdxUnordered{1}, {}, PhiR->hasUsesOutsideReductionChain());
+        *FindLastSelect, RdxUnordered{1}, {},
+        PhiR->hasUsesOutsideReductionChain());
     NewPhiR->insertBefore(PhiR);
     PhiR->replaceAllUsesWith(NewPhiR);
     PhiR->eraseFromParent();


        


More information about the llvm-commits mailing list