diff options
author | Fedor Sergeev <fedor.sergeev@azul.com> | 2017-12-01 18:33:58 +0000 |
---|---|---|
committer | Fedor Sergeev <fedor.sergeev@azul.com> | 2017-12-01 18:33:58 +0000 |
commit | 3b459c3847689b77bcc46681bc88997e5a6d131c (patch) | |
tree | 0c1b4f7c9ca6d4387a936f8dcd0b111efea91327 /llvm/lib/Analysis/LoopInfo.cpp | |
parent | ba8016d697783d8a063e0c43aac253717c1dda8d (diff) | |
download | llvm-3b459c3847689b77bcc46681bc88997e5a6d131c.zip llvm-3b459c3847689b77bcc46681bc88997e5a6d131c.tar.gz llvm-3b459c3847689b77bcc46681bc88997e5a6d131c.tar.bz2 |
IR printing improvement for loop passes - handle -print-module-scope
Summary:
Adding support for -print-module-scope similar to how it is
being done for function passes. This option causes loop-pass printer
to emit a whole-module IR instead of just a loop itself.
Reviewers: sanjoy, silvas, weimingz
Reviewed By: sanjoy
Subscribers: apilipenko, skatkov, llvm-commits
Differential Revision: https://reviews.llvm.org/D40247
llvm-svn: 319566
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index dce66fd..9e54d60 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -731,6 +731,18 @@ PreservedAnalyses LoopPrinterPass::run(Function &F, } void llvm::printLoop(Loop &L, raw_ostream &OS, const std::string &Banner) { + + if (forcePrintModuleIR()) { + // handling -print-module-scope + OS << Banner << " (loop: "; + L.getHeader()->printAsOperand(OS, false); + OS << ")\n"; + + // printing whole module + OS << *L.getHeader()->getModule(); + return; + } + OS << Banner; auto *PreHeader = L.getLoopPreheader(); |