[PATCH] D126242: [BOLT][NFC] Use for_each to simplify printLoopInfo

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 18:05:50 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5d8247d4c7c4: [BOLT][NFC] Use for_each to simplify printLoopInfo (authored by Amir).

Changed prior to commit:
  https://reviews.llvm.org/D126242?vs=431483&id=431852#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126242/new/

https://reviews.llvm.org/D126242

Files:
  bolt/lib/Core/BinaryFunction.cpp


Index: bolt/lib/Core/BinaryFunction.cpp
===================================================================
--- bolt/lib/Core/BinaryFunction.cpp
+++ bolt/lib/Core/BinaryFunction.cpp
@@ -18,6 +18,7 @@
 #include "bolt/Utils/NameResolver.h"
 #include "bolt/Utils/NameShortener.h"
 #include "bolt/Utils/Utils.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/edit_distance.h"
@@ -4446,14 +4447,12 @@
   OS << "\n";
 
   std::stack<BinaryLoop *> St;
-  for (auto I = BLI->begin(), E = BLI->end(); I != E; ++I)
-    St.push(*I);
+  for_each(*BLI, [&](BinaryLoop *L) { St.push(L); });
   while (!St.empty()) {
     BinaryLoop *L = St.top();
     St.pop();
 
-    for (BinaryLoop::iterator I = L->begin(), E = L->end(); I != E; ++I)
-      St.push(*I);
+    for_each(*L, [&](BinaryLoop *Inner) { St.push(Inner); });
 
     if (!hasValidProfile())
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126242.431852.patch
Type: text/x-patch
Size: 927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220525/64265eec/attachment.bin>


More information about the llvm-commits mailing list