mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
2a2896669d
Being lazy with printing the banner seems hard to reason with, we should print it unconditionally first (it could also lead to duplicate banners if we have multiple functions in -filter-print-funcs). The printIR() functions were doing too many things. I separated out the call from PrintPassInstrumentation since we were essentially doing two completely separate things in printIR() from different callers. There were multiple ways to generate the name of some IR. That's all been moved to getIRName(). The printing of the IR name was also inconsistent, now it's always "IR Dump on $foo" where "$foo" is the name. For a function, it's the function name. For a loop, it's what's printed by Loop::print(), which is more detailed. For an SCC, it's the list of functions in parentheses. For a module it's "[module]", to differentiate between a possible SCC with a function called "module". To preserve D74814, we have to check if we're going to print anything at all first. This is unfortunate, but I would consider this a special case that shouldn't be handled in the core logic. Reviewed By: jamieschmeiser Differential Revision: https://reviews.llvm.org/D100231
51 lines
2.9 KiB
LLVM
51 lines
2.9 KiB
LLVM
; Check pass name is only printed once.
|
|
; Check only one function is printed
|
|
; RUN: opt < %s 2>&1 -forceattrs -disable-output -print-after-all -filter-print-funcs=foo | FileCheck %s -check-prefix=FOO
|
|
; RUN: opt < %s 2>&1 -passes=forceattrs -disable-output -print-after-all -filter-print-funcs=foo | FileCheck %s -check-prefix=FOO
|
|
|
|
; Check pass name is only printed once.
|
|
; Check both functions are printed
|
|
; RUN: opt < %s 2>&1 -forceattrs -disable-output -print-after-all -filter-print-funcs=foo,bar | FileCheck %s -check-prefix=BOTH
|
|
; RUN: opt < %s 2>&1 -passes=forceattrs -disable-output -print-after-all -filter-print-funcs=foo,bar | FileCheck %s -check-prefix=BOTH
|
|
|
|
; Check pass name is not printed if a module/SCC doesn't include any function specified in -filter-print-funcs.
|
|
; RUN: opt < %s 2>&1 -forceattrs -disable-output -print-after-all -filter-print-funcs=baz | FileCheck %s -allow-empty -check-prefix=EMPTY
|
|
; RUN: opt < %s 2>&1 -passes=forceattrs -disable-output -print-after-all -filter-print-funcs=baz | FileCheck %s -allow-empty -check-prefix=EMPTY
|
|
; RUN: opt < %s 2>&1 -passes=no-op-cgscc -disable-output -print-after-all -filter-print-funcs=baz | FileCheck %s -allow-empty -check-prefix=EMPTY
|
|
|
|
; Check whole module is printed with user-specified wildcast switch -filter-print-funcs=* or -print-module-scope
|
|
; RUN: opt < %s 2>&1 -forceattrs -disable-output -print-after-all | FileCheck %s -check-prefix=ALL
|
|
; RUN: opt < %s 2>&1 -forceattrs -disable-output -print-after-all -filter-print-funcs=* | FileCheck %s -check-prefix=ALL
|
|
; RUN: opt < %s 2>&1 -forceattrs -disable-output -print-after-all -filter-print-funcs=foo -print-module-scope | FileCheck %s -check-prefix=ALL
|
|
; RUN: opt < %s 2>&1 -passes=forceattrs -disable-output -print-after-all | FileCheck %s -check-prefix=ALL
|
|
; RUN: opt < %s 2>&1 -passes=forceattrs -disable-output -print-after-all -filter-print-funcs=* | FileCheck %s -check-prefix=ALL
|
|
; RUN: opt < %s 2>&1 -passes=forceattrs -disable-output -print-after-all -filter-print-funcs=foo -print-module-scope | FileCheck %s -check-prefix=ALL
|
|
|
|
; FOO: IR Dump After {{Force set function attributes|ForceFunctionAttrsPass}}
|
|
; FOO: define void @foo
|
|
; FOO-NOT: define void @bar
|
|
; FOO-NOT: IR Dump After {{Force set function attributes|ForceFunctionAttrsPass}}
|
|
|
|
; BOTH: IR Dump After {{Force set function attributes|ForceFunctionAttrsPass}}
|
|
; BOTH: define void @foo
|
|
; BOTH: define void @bar
|
|
; BOTH-NOT: IR Dump After {{Force set function attributes|ForceFunctionAttrsPass}}
|
|
; BOTH-NOT: ModuleID =
|
|
|
|
; EMPTY-NOT: IR Dump After {{Force set function attributes|ForceFunctionAttrsPass}}
|
|
; EMPTY-NOT: IR Dump After NoOp
|
|
|
|
; ALL: IR Dump After {{Force set function attributes|ForceFunctionAttrsPass}}
|
|
; ALL: ModuleID =
|
|
; ALL: define void @foo
|
|
; ALL: define void @bar
|
|
; ALL-NOT: IR Dump After {{Force set function attributes|ForceFunctionAttrsPass}}
|
|
|
|
define void @foo() {
|
|
ret void
|
|
}
|
|
|
|
define void @bar() {
|
|
ret void
|
|
}
|