[llvm] a3b9c15 - [tools] Use llvm::is_contained (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 23:36:20 PDT 2023


Author: Kazu Hirata
Date: 2023-06-19T23:36:14-07:00
New Revision: a3b9c1533e9e83c6f966205d0a0000fe72624864

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

LOG: [tools] Use llvm::is_contained (NFC)

Added: 
    

Modified: 
    llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
    llvm/tools/llvm-profgen/MissingFrameInferrer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp b/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
index b4f3c5aa79852..cd719f2101679 100644
--- a/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
+++ b/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
@@ -377,8 +377,7 @@ Error linkDebugInfoImpl(object::ObjectFile &File, const Options &Options,
 
           if (Options.AccelTableKind == DwarfUtilAccelKind::None)
             AccelTableNamesToDelete.push_back(Sec.Name);
-          else if (std::find(AccelTables.begin(), AccelTables.end(),
-                             *SrcAccelTableKind) == AccelTables.end())
+          else if (!llvm::is_contained(AccelTables, *SrcAccelTableKind))
             AccelTableNamesToReplace.push_back(Sec.Name);
         } else if (!knownByDWARFUtil(Sec.Name)) {
           assert(!SrcAccelTableKind);

diff  --git a/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp b/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
index 4127fdc54bd18..ee49950f39ca4 100644
--- a/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
+++ b/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp
@@ -242,10 +242,8 @@ bool MissingFrameInferrer::inferMissingFrames(
 
   // Done with the inference if the calle is reachable via a single callsite.
   // This may not be accurate but it improves the search throughput.
-  for (auto Target : CallEdgesF[From]) {
-    if (Target == ToFRange->Func)
-      return true;
-  }
+  if (llvm::is_contained(CallEdgesF[From], ToFRange->Func))
+    return true;
 
   // Bail out if callee is not tailcall reachable at all.
   if (!TailCallTargetFuncs.contains(ToFRange->Func))


        


More information about the llvm-commits mailing list