diff options
| author | Fedor Sergeev <fedor.sergeev@azul.com> | 2018-09-24 16:08:15 +0000 |
|---|---|---|
| committer | Fedor Sergeev <fedor.sergeev@azul.com> | 2018-09-24 16:08:15 +0000 |
| commit | 662e5686fe1c55cb5a46a960b9b00807c0c37b64 (patch) | |
| tree | bfa394d8cadad1bf232c8840ca9122d1746cfef3 /llvm/test | |
| parent | 8284b19c76a7bafdf4e53b3deb6cd35fcd370e92 (diff) | |
| download | bcm5719-llvm-662e5686fe1c55cb5a46a960b9b00807c0c37b64.tar.gz bcm5719-llvm-662e5686fe1c55cb5a46a960b9b00807c0c37b64.zip | |
[New PM][PassInstrumentation] IR printing support for New Pass Manager
Implementing -print-before-all/-print-after-all/-filter-print-func support
through PassInstrumentation callbacks.
- PrintIR routines implement printing callbacks.
- StandardInstrumentations class provides a central place to manage all
the "standard" in-tree pass instrumentations. Currently it registers
PrintIR callbacks.
Reviewers: chandlerc, paquette, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D50923
llvm-svn: 342896
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Other/loop-pass-printer.ll | 27 | ||||
| -rw-r--r-- | llvm/test/Other/print-module-scope.ll | 12 | ||||
| -rw-r--r-- | llvm/test/Other/printer.ll | 23 |
3 files changed, 44 insertions, 18 deletions
diff --git a/llvm/test/Other/loop-pass-printer.ll b/llvm/test/Other/loop-pass-printer.ll index bedcf164ace..ba752264586 100644 --- a/llvm/test/Other/loop-pass-printer.ll +++ b/llvm/test/Other/loop-pass-printer.ll @@ -5,14 +5,22 @@ ; RUN: -loop-deletion -print-before=loop-deletion \ ; RUN: | FileCheck %s -check-prefix=DEL ; RUN: opt < %s 2>&1 -disable-output \ +; RUN: -passes='loop(loop-deletion)' -print-before-all \ +; RUN: | FileCheck %s -check-prefix=DEL +; RUN: opt < %s 2>&1 -disable-output \ ; RUN: -loop-unroll -print-after=loop-unroll -filter-print-funcs=bar \ +; RUN: | FileCheck %s -check-prefix=BAR -check-prefix=BAR-OLD +; RUN: opt < %s 2>&1 -disable-output \ +; RUN: -passes='require<opt-remark-emit>,loop(unroll-full)' -print-after-all -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 -check-prefix=FOO-MODULE-OLD +; RUN: opt < %s 2>&1 -disable-output \ +; RUN: -passes='require<opt-remark-emit>,loop(unroll-full)' -print-after-all -filter-print-funcs=foo -print-module-scope \ ; RUN: | FileCheck %s -check-prefix=FOO-MODULE -; DEL: IR Dump Before -; DEL-SAME: dead loops +; DEL: IR Dump Before {{Delete dead loops|LoopDeletionPass}} ; DEL: ; Preheader: ; DEL-NEXT: %idx = alloca i32, align 4 ; DEL: ; Loop: @@ -20,8 +28,7 @@ ; DEL: cont: ; DEL: ; Exit blocks ; DEL: done: -; DEL: IR Dump Before -; DEL-SAME: dead loops +; DEL: IR Dump Before {{Delete dead loops|LoopDeletionPass}} ; DEL: ; Preheader: ; DEL-NEXT: br label %loop ; DEL: ; Loop: @@ -29,24 +36,22 @@ ; DEL: ; Exit blocks ; DEL: end: -; BAR: IR Dump After -; BAR-SAME: Unroll +; BAR: IR Dump After {{Unroll|LoopFullUnrollPass}} ; BAR: ; Preheader: ; BAR-NEXT: br label %loop ; BAR: ; Loop: ; BAR-NEXT: loop: ; BAR: ; Exit blocks ; BAR: end: -; BAR-NOT: IR Dump -; BAR-NOT: ; Loop +; BAR-OLD-NOT: IR Dump +; BAR-OLD-NOT: ; Loop -; FOO-MODULE: IR Dump After -; FOO-MODULE-SAME: Unroll +; FOO-MODULE: IR Dump After {{Unroll|LoopFullUnrollPass}} ; FOO-MODULE-SAME: loop: %loop ; FOO-MODULE-NEXT: ModuleID = ; FOO-MODULE: define void @foo ; FOO-MODULE: define void @bar -; FOO-MODULE-NOT: IR Dump +; FOO-MODULE-OLD-NOT: IR Dump define void @foo(){ %idx = alloca i32, align 4 diff --git a/llvm/test/Other/print-module-scope.ll b/llvm/test/Other/print-module-scope.ll index 0e9c4d59cc3..a6f744657b6 100644 --- a/llvm/test/Other/print-module-scope.ll +++ b/llvm/test/Other/print-module-scope.ll @@ -7,10 +7,16 @@ ; RUN: -simplifycfg -print-after=simplifycfg -print-module-scope \ ; RUN: | FileCheck %s -check-prefix=CFG ; RUN: opt < %s 2>&1 -disable-output \ +; RUN: -passes=simplify-cfg -print-after-all -print-module-scope \ +; RUN: | FileCheck %s -check-prefix=CFG +; RUN: opt < %s 2>&1 -disable-output \ ; RUN: -simplifycfg -print-after=simplifycfg -filter-print-funcs=foo -print-module-scope \ ; RUN: | FileCheck %s -check-prefix=FOO +; RUN: opt < %s 2>&1 -disable-output \ +; RUN: -passes=simplify-cfg -print-after-all -filter-print-funcs=foo -print-module-scope \ +; RUN: | FileCheck %s -check-prefix=FOO -; CFG: IR Dump After +; CFG: IR Dump After {{Simplify the CFG|SimplifyCFGPass}} ; CFG-SAME: function: foo ; CFG-NEXT: ModuleID = ; CFG: define void @foo @@ -23,7 +29,7 @@ ; CFG: define void @bar ; CFG: declare void @baz -; FOO: IR Dump After +; FOO: IR Dump After {{Simplify the CFG|SimplifyCFGPass}} ; FOO-NOT: function: bar ; FOO-SAME: function: foo ; FOO-NEXT: ModuleID = @@ -52,4 +58,4 @@ attributes #1 = { nounwind readnone ssp "use-soft-float"="false" } ; FOO: attributes #{{[0-9]}} = { nounwind readnone ssp "use-soft-float"="false" } -; FOO-NOT: IR Dump +; FOO-NOT: IR Dump After {{Simplify the CFG|SimplifyCFGPass}} diff --git a/llvm/test/Other/printer.ll b/llvm/test/Other/printer.ll index ac1abd70495..9785a17b228 100644 --- a/llvm/test/Other/printer.ll +++ b/llvm/test/Other/printer.ll @@ -1,4 +1,5 @@ -; RUN: opt -mem2reg -instcombine -print-after-all -S < %s 2>&1 | FileCheck %s +; RUN: opt -mem2reg -instcombine -print-after-all -disable-output < %s 2>&1 | FileCheck %s +; RUN: opt -passes='mem2reg,instcombine' -print-after-all -disable-output < %s 2>&1 | FileCheck %s define void @tester(){ ret void } @@ -7,7 +8,21 @@ define void @foo(){ ret void } -;CHECK: IR Dump After Promote Memory to Register -;CHECK: IR Dump After Combine redundant instructions -;CHECK: IR Dump After Module Verifier +;CHECK-NOT: IR Dump After PassManager +;CHECK-NOT: IR Dump After ModuleToFunctionPassAdaptor +; +;CHECK: *** IR Dump After {{Promote Memory to Register|PromotePass}} +;CHECK: define void @tester +;CHECK-NOT: define void @foo +;CHECK: *** IR Dump After {{Combine redundant instructions|InstCombinePass}} +;CHECK: define void @tester +;CHECK-NOT: define void @foo +;CHECK: *** IR Dump After {{Promote Memory to Register|PromotePass}} +;CHECK: define void @foo +;CHECK-NOT: define void @tester +;CHECK: *** IR Dump After {{Combine redundant instructions|InstCombinePass}} +;CHECK: define void @foo +;CHECK-NOT: define void @tester +;CHECK: *** IR Dump After {{Module Verifier|VerifierPass}} +; ;CHECK-NOT: IR Dump After Print Module IR |

