diff options
| author | Fedor Sergeev <fedor.sergeev@azul.com> | 2018-12-03 14:48:15 +0000 |
|---|---|---|
| committer | Fedor Sergeev <fedor.sergeev@azul.com> | 2018-12-03 14:48:15 +0000 |
| commit | 7254d3c51c12ada02b1d75c5bfe22a7fdd87a120 (patch) | |
| tree | 43d7b6299e89df6d273671367c6be61eac6f3ea0 /llvm/lib/Analysis | |
| parent | 89230f7bc29946d534ee26f40472babebc3e4ed5 (diff) | |
| download | bcm5719-llvm-7254d3c51c12ada02b1d75c5bfe22a7fdd87a120.tar.gz bcm5719-llvm-7254d3c51c12ada02b1d75c5bfe22a7fdd87a120.zip | |
Fixing -print-module-scope for legacy SCC passes
It appears that print-module-scope was not implemented for legacy SCC passes.
Fixed to print a whole module instead of just current SCC.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D54793
llvm-svn: 348144
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/CallGraphSCCPass.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/CallGraphSCCPass.cpp b/llvm/lib/Analysis/CallGraphSCCPass.cpp index 80d0427529a..0aed57a3938 100644 --- a/llvm/lib/Analysis/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/CallGraphSCCPass.cpp @@ -633,23 +633,40 @@ namespace { bool runOnSCC(CallGraphSCC &SCC) override { bool BannerPrinted = false; - auto PrintBannerOnce = [&] () { + auto PrintBannerOnce = [&]() { if (BannerPrinted) return; OS << Banner; BannerPrinted = true; - }; + }; + + bool NeedModule = llvm::forcePrintModuleIR(); + if (isFunctionInPrintList("*") && NeedModule) { + PrintBannerOnce(); + OS << "\n"; + SCC.getCallGraph().getModule().print(OS, nullptr); + return false; + } + bool FoundFunction = false; for (CallGraphNode *CGN : SCC) { if (Function *F = CGN->getFunction()) { if (!F->isDeclaration() && isFunctionInPrintList(F->getName())) { - PrintBannerOnce(); - F->print(OS); + FoundFunction = true; + if (!NeedModule) { + PrintBannerOnce(); + F->print(OS); + } } } else if (isFunctionInPrintList("*")) { PrintBannerOnce(); OS << "\nPrinting <null> Function\n"; } } + if (NeedModule && FoundFunction) { + PrintBannerOnce(); + OS << "\n"; + SCC.getCallGraph().getModule().print(OS, nullptr); + } return false; } |

