[llvm] [LV] Use findUserOf to improve code (NFC) (PR #207427)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 3 09:40:27 PDT 2026
https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/207427
None
>From cedc63897736ed7020c21a3e7d2a2788ea75882f Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <artagnon at tenstorrent.com>
Date: Fri, 3 Jul 2026 17:38:21 +0100
Subject: [PATCH] [LV] Use findUserOf to improve code (NFC)
---
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
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