summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorFedor Sergeev <fedor.sergeev@azul.com>2017-12-01 18:33:58 +0000
committerFedor Sergeev <fedor.sergeev@azul.com>2017-12-01 18:33:58 +0000
commit5608259c999fb77c5d6093895696f4daebe6b8cd (patch)
treec98b295d28233f3d28836217497677031c3d2f1d /lib/Analysis
parent89e6e155520847b5d27bfaf6f0c699e46cfec771 (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319566 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/LoopInfo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index dce66fd3d96..9e54d60779a 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/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();