mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
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
This commit is contained in:
parent
f7dfbc90e5
commit
351bfe9d50
@ -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();
|
||||
|
@ -7,7 +7,9 @@
|
||||
; RUN: opt < %s 2>&1 -disable-output \
|
||||
; RUN: -loop-unroll -print-after=loop-unroll -filter-print-funcs=bar \
|
||||
; RUN: | FileCheck %s -check-prefix=BAR
|
||||
;
|
||||
; RUN: opt < %s 2>&1 -disable-output \
|
||||
; RUN: -loop-unroll -print-after=loop-unroll -filter-print-funcs=foo -print-module-scope \
|
||||
; RUN: | FileCheck %s -check-prefix=FOO-MODULE
|
||||
|
||||
; DEL: IR Dump Before
|
||||
; DEL-SAME: dead loops
|
||||
@ -35,9 +37,17 @@
|
||||
; BAR-NEXT: loop:
|
||||
; BAR: ; Exit blocks
|
||||
; BAR: end:
|
||||
; BAR-NOT: IR Dump Before
|
||||
; BAR-NOT: IR Dump
|
||||
; BAR-NOT: ; Loop
|
||||
|
||||
; FOO-MODULE: IR Dump After
|
||||
; FOO-MODULE-SAME: Unroll
|
||||
; FOO-MODULE-SAME: loop: %loop
|
||||
; FOO-MODULE-NEXT: ModuleID =
|
||||
; FOO-MODULE: define void @foo
|
||||
; FOO-MODULE: define void @bar
|
||||
; FOO-MODULE-NOT: IR Dump
|
||||
|
||||
define void @foo(){
|
||||
%idx = alloca i32, align 4
|
||||
store i32 0, i32* %idx, align 4
|
||||
|
Loading…
x
Reference in New Issue
Block a user