[llvm] [llvm-mca] Use llvm::erase_if (NFC) (PR #96029)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 23:40:44 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/96029

None

>From f50afbd9936c7bef7889f3b5a62a34abb22cfb5f Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 18 Jun 2024 23:34:18 -0700
Subject: [PATCH] [llvm-mca] Use llvm::erase_if (NFC)

---
 llvm/tools/llvm-mca/CodeRegion.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/llvm/tools/llvm-mca/CodeRegion.h b/llvm/tools/llvm-mca/CodeRegion.h
index 5a2e8baa1f3e7..ef8804f1b494c 100644
--- a/llvm/tools/llvm-mca/CodeRegion.h
+++ b/llvm/tools/llvm-mca/CodeRegion.h
@@ -104,11 +104,9 @@ class CodeRegion {
   dropInstructions(const llvm::SmallPtrSetImpl<const llvm::MCInst *> &Insts) {
     if (Insts.empty())
       return Instructions;
-    Instructions.erase(std::remove_if(Instructions.begin(), Instructions.end(),
-                                      [&Insts](const llvm::MCInst &Inst) {
-                                        return Insts.contains(&Inst);
-                                      }),
-                       Instructions.end());
+    llvm::erase_if(Instructions, [&Insts](const llvm::MCInst &Inst) {
+      return Insts.contains(&Inst);
+    });
     return Instructions;
   }
 



More information about the llvm-commits mailing list