[llvm] [IVDesc] Prefer empty m_Cmp on unused result (NFC) (PR #141071)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Thu May 22 07:25:14 PDT 2025
https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/141071
None
>From 9d89923986ea17062e7ec1a835d74620b9c27462 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Thu, 22 May 2025 15:22:28 +0100
Subject: [PATCH] [IVDesc] Prefer empty m_Cmp on unused result (NFC)
---
llvm/lib/Analysis/IVDescriptors.cpp | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/llvm/lib/Analysis/IVDescriptors.cpp b/llvm/lib/Analysis/IVDescriptors.cpp
index a273338670164..6b7d31463d3a6 100644
--- a/llvm/lib/Analysis/IVDescriptors.cpp
+++ b/llvm/lib/Analysis/IVDescriptors.cpp
@@ -630,14 +630,12 @@ RecurrenceDescriptor::isAnyOfPattern(Loop *Loop, PHINode *OrigPhi,
Instruction *I, InstDesc &Prev) {
// We must handle the select(cmp(),x,y) as a single instruction. Advance to
// the select.
- CmpPredicate Pred;
- if (match(I, m_OneUse(m_Cmp(Pred, m_Value(), m_Value())))) {
+ if (match(I, m_OneUse(m_Cmp()))) {
if (auto *Select = dyn_cast<SelectInst>(*I->user_begin()))
return InstDesc(Select, Prev.getRecKind());
}
- if (!match(I,
- m_Select(m_Cmp(Pred, m_Value(), m_Value()), m_Value(), m_Value())))
+ if (!match(I, m_Select(m_Cmp(), m_Value(), m_Value())))
return InstDesc(false, I);
SelectInst *SI = cast<SelectInst>(I);
@@ -759,16 +757,14 @@ RecurrenceDescriptor::isMinMaxPattern(Instruction *I, RecurKind Kind,
// We must handle the select(cmp()) as a single instruction. Advance to the
// select.
- CmpPredicate Pred;
- if (match(I, m_OneUse(m_Cmp(Pred, m_Value(), m_Value())))) {
+ if (match(I, m_OneUse(m_Cmp()))) {
if (auto *Select = dyn_cast<SelectInst>(*I->user_begin()))
return InstDesc(Select, Prev.getRecKind());
}
// Only match select with single use cmp condition, or a min/max intrinsic.
if (!isa<IntrinsicInst>(I) &&
- !match(I, m_Select(m_OneUse(m_Cmp(Pred, m_Value(), m_Value())), m_Value(),
- m_Value())))
+ !match(I, m_Select(m_OneUse(m_Cmp()), m_Value(), m_Value())))
return InstDesc(false, I);
// Look for a min/max pattern.
More information about the llvm-commits
mailing list