Skip to content

Commit

Permalink
Improve the -filter-print-funcs option to skip the banner for CGSCC…
Browse files Browse the repository at this point in the history
… pass when nothing is to be printed

Before, it would print a sequence of:

  *** IR Dump After Function Integration/Inlining ******
  *** IR Dump After Function Integration/Inlining ******
  *** IR Dump After Function Integration/Inlining ******
  ...

for every single function in the module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292442 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
joker-eph committed Jan 18, 2017
1 parent 4683557 commit 01355e8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/Analysis/CallGraphSCCPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,13 +609,23 @@ namespace {
}

bool runOnSCC(CallGraphSCC &SCC) override {
Out << Banner;
auto PrintBannerOnce = [&] () {
static bool BannerPrinted = false;
if (BannerPrinted)
return;
Out << Banner;
BannerPrinted = true;
};
for (CallGraphNode *CGN : SCC) {
if (CGN->getFunction()) {
if (isFunctionInPrintList(CGN->getFunction()->getName()))
if (isFunctionInPrintList(CGN->getFunction()->getName())) {
PrintBannerOnce();
CGN->getFunction()->print(Out);
} else
}
} else if (llvm::isFunctionInPrintList("*")) {
PrintBannerOnce();
Out << "\nPrinting <null> Function\n";
}
}
return false;
}
Expand Down

0 comments on commit 01355e8

Please sign in to comment.