[llvm] f78d4b0 - [LV] Use findUserOf to improve addReductionResultComputation (NFC) (#207427)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 4 02:23:37 PDT 2026


Author: Ramkumar Ramachandra
Date: 2026-07-04T10:23:32+01:00
New Revision: f78d4b083b462607b518db6fed5ac8204de95e13

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

LOG: [LV] Use findUserOf to improve addReductionResultComputation (NFC) (#207427)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c03a9b20bcd19..21507fe40c7f1 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6943,10 +6943,8 @@ void LoopVectorizationPlanner::addReductionResultComputation(
     // the reduction phi to operate on bools before creating the final
     // reduction result.
     if (RecurrenceDescriptor::isAnyOfRecurrenceKind(RecurrenceKind)) {
-      auto *AnyOfSelect =
-          cast<VPSingleDefRecipe>(*find_if(PhiR->users(), [](VPUser *U) {
-            return match(U, m_Select(m_VPValue(), m_VPValue(), m_VPValue()));
-          }));
+      auto *AnyOfSelect = cast<VPSingleDefRecipe>(
+          findUserOf(PhiR, m_Select(m_VPValue(), m_VPValue(), m_VPValue())));
       VPValue *Start = PhiR->getStartValue();
       bool TrueValIsPhi = AnyOfSelect->getOperand(1) == PhiR;
       // NewVal is the non-phi operand of the select.


        


More information about the llvm-commits mailing list