Fedor Sergeev | 94dca7c | 2017-12-01 17:42:46 +0000 | [diff] [blame] | 1 | ; This test is checking basic properties of -print-module-scope options: |
| 2 | ; - dumps all the module IR at once |
| 3 | ; - all the function attributes are shown, including those of declarations |
| 4 | ; - works on top of -print-after and -filter-print-funcs |
| 5 | ; |
Arthur Eubanks | 2af4c2b | 2020-08-17 17:48:04 -0700 | [diff] [blame] | 6 | ; RUN: opt -enable-new-pm=0 < %s 2>&1 -disable-output \ |
Fedor Sergeev | 94dca7c | 2017-12-01 17:42:46 +0000 | [diff] [blame] | 7 | ; RUN: -simplifycfg -print-after=simplifycfg -print-module-scope \ |
| 8 | ; RUN: | FileCheck %s -check-prefix=CFG |
| 9 | ; RUN: opt < %s 2>&1 -disable-output \ |
Fedor Sergeev | 662e568 | 2018-09-24 16:08:15 +0000 | [diff] [blame] | 10 | ; RUN: -passes=simplify-cfg -print-after-all -print-module-scope \ |
| 11 | ; RUN: | FileCheck %s -check-prefix=CFG |
Arthur Eubanks | 2af4c2b | 2020-08-17 17:48:04 -0700 | [diff] [blame] | 12 | ; RUN: opt -enable-new-pm=0 < %s 2>&1 -disable-output \ |
Fedor Sergeev | 94dca7c | 2017-12-01 17:42:46 +0000 | [diff] [blame] | 13 | ; RUN: -simplifycfg -print-after=simplifycfg -filter-print-funcs=foo -print-module-scope \ |
| 14 | ; RUN: | FileCheck %s -check-prefix=FOO |
Fedor Sergeev | 662e568 | 2018-09-24 16:08:15 +0000 | [diff] [blame] | 15 | ; RUN: opt < %s 2>&1 -disable-output \ |
| 16 | ; RUN: -passes=simplify-cfg -print-after-all -filter-print-funcs=foo -print-module-scope \ |
| 17 | ; RUN: | FileCheck %s -check-prefix=FOO |
Fedor Sergeev | 94dca7c | 2017-12-01 17:42:46 +0000 | [diff] [blame] | 18 | |
Fedor Sergeev | 662e568 | 2018-09-24 16:08:15 +0000 | [diff] [blame] | 19 | ; CFG: IR Dump After {{Simplify the CFG|SimplifyCFGPass}} |
Fedor Sergeev | 94dca7c | 2017-12-01 17:42:46 +0000 | [diff] [blame] | 20 | ; CFG-SAME: function: foo |
| 21 | ; CFG-NEXT: ModuleID = |
| 22 | ; CFG: define void @foo |
| 23 | ; CFG: define void @bar |
| 24 | ; CFG: declare void @baz |
| 25 | ; CFG: IR Dump After |
| 26 | ; CFG-SAME: function: bar |
| 27 | ; CFG-NEXT: ModuleID = |
| 28 | ; CFG: define void @foo |
| 29 | ; CFG: define void @bar |
| 30 | ; CFG: declare void @baz |
| 31 | |
Fedor Sergeev | 662e568 | 2018-09-24 16:08:15 +0000 | [diff] [blame] | 32 | ; FOO: IR Dump After {{Simplify the CFG|SimplifyCFGPass}} |
Fedor Sergeev | 94dca7c | 2017-12-01 17:42:46 +0000 | [diff] [blame] | 33 | ; FOO-NOT: function: bar |
| 34 | ; FOO-SAME: function: foo |
| 35 | ; FOO-NEXT: ModuleID = |
| 36 | ; FOO: Function Attrs: nounwind ssp |
| 37 | ; FOO: define void @foo |
| 38 | ; FOO: Function Attrs: nounwind |
| 39 | ; FOO: define void @bar |
| 40 | ; FOO: Function Attrs: nounwind readnone ssp |
| 41 | ; FOO: declare void @baz |
| 42 | |
| 43 | define void @foo() nounwind ssp { |
| 44 | call void @baz() |
| 45 | ret void |
| 46 | } |
| 47 | |
| 48 | define void @bar() #0 { |
| 49 | ret void |
| 50 | } |
| 51 | |
| 52 | declare void @baz() #1 |
| 53 | |
Fangrui Song | 502a77f | 2019-12-24 15:52:21 -0800 | [diff] [blame] | 54 | attributes #0 = { nounwind "frame-pointer"="all" } |
Fedor Sergeev | 94dca7c | 2017-12-01 17:42:46 +0000 | [diff] [blame] | 55 | |
| 56 | attributes #1 = { nounwind readnone ssp "use-soft-float"="false" } |
Fangrui Song | 502a77f | 2019-12-24 15:52:21 -0800 | [diff] [blame] | 57 | ; FOO: attributes #{{[0-9]}} = { nounwind "frame-pointer"="all" } |
Fedor Sergeev | 94dca7c | 2017-12-01 17:42:46 +0000 | [diff] [blame] | 58 | |
| 59 | ; FOO: attributes #{{[0-9]}} = { nounwind readnone ssp "use-soft-float"="false" } |
| 60 | |
Fedor Sergeev | 662e568 | 2018-09-24 16:08:15 +0000 | [diff] [blame] | 61 | ; FOO-NOT: IR Dump After {{Simplify the CFG|SimplifyCFGPass}} |