blob: 08d6bbb3a28b0a949a117d7a21135368a8530c82 [file] [log] [blame]
Fedor Sergeev94dca7c2017-12-01 17:42:46 +00001; 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 Eubanks2af4c2b2020-08-17 17:48:04 -07006; RUN: opt -enable-new-pm=0 < %s 2>&1 -disable-output \
Fedor Sergeev94dca7c2017-12-01 17:42:46 +00007; RUN: -simplifycfg -print-after=simplifycfg -print-module-scope \
8; RUN: | FileCheck %s -check-prefix=CFG
9; RUN: opt < %s 2>&1 -disable-output \
Fedor Sergeev662e5682018-09-24 16:08:15 +000010; RUN: -passes=simplify-cfg -print-after-all -print-module-scope \
11; RUN: | FileCheck %s -check-prefix=CFG
Arthur Eubanks2af4c2b2020-08-17 17:48:04 -070012; RUN: opt -enable-new-pm=0 < %s 2>&1 -disable-output \
Fedor Sergeev94dca7c2017-12-01 17:42:46 +000013; RUN: -simplifycfg -print-after=simplifycfg -filter-print-funcs=foo -print-module-scope \
14; RUN: | FileCheck %s -check-prefix=FOO
Fedor Sergeev662e5682018-09-24 16:08:15 +000015; 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 Sergeev94dca7c2017-12-01 17:42:46 +000018
Fedor Sergeev662e5682018-09-24 16:08:15 +000019; CFG: IR Dump After {{Simplify the CFG|SimplifyCFGPass}}
Fedor Sergeev94dca7c2017-12-01 17:42:46 +000020; 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 Sergeev662e5682018-09-24 16:08:15 +000032; FOO: IR Dump After {{Simplify the CFG|SimplifyCFGPass}}
Fedor Sergeev94dca7c2017-12-01 17:42:46 +000033; 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
43define void @foo() nounwind ssp {
44 call void @baz()
45 ret void
46}
47
48define void @bar() #0 {
49 ret void
50}
51
52declare void @baz() #1
53
Fangrui Song502a77f2019-12-24 15:52:21 -080054attributes #0 = { nounwind "frame-pointer"="all" }
Fedor Sergeev94dca7c2017-12-01 17:42:46 +000055
56attributes #1 = { nounwind readnone ssp "use-soft-float"="false" }
Fangrui Song502a77f2019-12-24 15:52:21 -080057; FOO: attributes #{{[0-9]}} = { nounwind "frame-pointer"="all" }
Fedor Sergeev94dca7c2017-12-01 17:42:46 +000058
59; FOO: attributes #{{[0-9]}} = { nounwind readnone ssp "use-soft-float"="false" }
60
Fedor Sergeev662e5682018-09-24 16:08:15 +000061; FOO-NOT: IR Dump After {{Simplify the CFG|SimplifyCFGPass}}