[llvm] [AMDGPU] Use llvm::any_of and llvm::none_of (NFC) (PR #102794)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 10:31:07 PDT 2024


https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/102794

>From 51c648b10cb3e7dccc69d7cb2c26ac8f5d10b389 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 10 Aug 2024 23:35:25 -0700
Subject: [PATCH 1/2] [AMDGPU] Use llvm::any_of and llvm::none_of (NFC)

---
 llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
index 1ddf6686b97e74..14ff71e022a38b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
@@ -1430,19 +1430,16 @@ bool MFMAExpInterleaveOpt::analyzeDAG(const SIInstrInfo *TII) {
   if (!(TempExp && TempMFMA))
     return false;
 
-  HasChainBetweenCvt =
-      std::find_if((*TempExp)->Succs.begin(), (*TempExp)->Succs.end(),
-                   [&isCvt](SDep &Succ) {
-                     return isCvt(Succ.getSUnit()->getInstr()->getOpcode());
-                   }) == (*TempExp)->Succs.end();
+  HasChainBetweenCvt = llvm::none_of((*TempExp)->Succs, [&isCvt](SDep &Succ) {
+    return isCvt(Succ.getSUnit()->getInstr()->getOpcode());
+  });
 
   // Count the number of MFMAs that are reached by an EXP
   for (auto &SuccSU : MFMAPipeCands) {
     if (MFMAPipeSUs.size() &&
-        std::find_if(MFMAPipeSUs.begin(), MFMAPipeSUs.end(),
-                     [&SuccSU](SUnit *PotentialMatch) {
-                       return PotentialMatch->NodeNum == SuccSU->NodeNum;
-                     }) != MFMAPipeSUs.end())
+        llvm::any_of(MFMAPipeSUs, [&SuccSU](SUnit *PotentialMatch) {
+          return PotentialMatch->NodeNum == SuccSU->NodeNum;
+        }))
       continue;
 
     for (auto &PredSU : ExpPipeCands) {

>From 5c74b48524cd71fdd4c314df19d55bc5fcedac92 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 12 Aug 2024 10:28:16 -0700
Subject: [PATCH 2/2] Drop llvm::.

---
 llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
index 14ff71e022a38b..1ad2302a4f20c6 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
@@ -1430,14 +1430,14 @@ bool MFMAExpInterleaveOpt::analyzeDAG(const SIInstrInfo *TII) {
   if (!(TempExp && TempMFMA))
     return false;
 
-  HasChainBetweenCvt = llvm::none_of((*TempExp)->Succs, [&isCvt](SDep &Succ) {
+  HasChainBetweenCvt = none_of((*TempExp)->Succs, [&isCvt](SDep &Succ) {
     return isCvt(Succ.getSUnit()->getInstr()->getOpcode());
   });
 
   // Count the number of MFMAs that are reached by an EXP
   for (auto &SuccSU : MFMAPipeCands) {
     if (MFMAPipeSUs.size() &&
-        llvm::any_of(MFMAPipeSUs, [&SuccSU](SUnit *PotentialMatch) {
+        any_of(MFMAPipeSUs, [&SuccSU](SUnit *PotentialMatch) {
           return PotentialMatch->NodeNum == SuccSU->NodeNum;
         }))
       continue;



More information about the llvm-commits mailing list