Improve the -filter-print-funcs option to skip the banner for CGSCC 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
This commit is contained in:
Mehdi Amini 2017-01-18 21:37:11 +00:00
parent 4683557a5f
commit 01355e8599

View File

@ -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;
}