Skip to content

Commit

Permalink
[BOLT][NFC] Use for_each to simplify printLoopInfo
Browse files Browse the repository at this point in the history
Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D126242
  • Loading branch information
aaupov committed May 25, 2022
1 parent b976fac commit 5d8247d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bolt/lib/Core/BinaryFunction.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -4446,14 +4447,12 @@ void BinaryFunction::printLoopInfo(raw_ostream &OS) const {
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;
Expand Down

0 comments on commit 5d8247d

Please sign in to comment.