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;
6; RUN: opt -enable-new-pm=0 < %s 2>&1 -disable-output \
7; RUN: 	   -simplifycfg -print-after=simplifycfg -print-module-scope \
8; RUN:	   | FileCheck %s -check-prefix=CFG
9; RUN: opt < %s 2>&1 -disable-output \
10; RUN: 	   -passes=simplifycfg -print-after-all -print-module-scope \
11; RUN:	   | FileCheck %s -check-prefix=CFG
12; RUN: opt -enable-new-pm=0 < %s 2>&1 -disable-output \
13; RUN: 	   -simplifycfg -print-after=simplifycfg -filter-print-funcs=foo -print-module-scope \
14; RUN:	   | FileCheck %s -check-prefix=FOO
15; RUN: opt < %s 2>&1 -disable-output \
16; RUN: 	   -passes=simplifycfg -print-after-all -filter-print-funcs=foo -print-module-scope \
17; RUN:	   | FileCheck %s -check-prefix=FOO
18
19; CFG:      IR Dump After {{Simplify the CFG|SimplifyCFGPass}} {{.*}}foo
20; CFG-NEXT: ModuleID =
21; CFG: define void @foo
22; CFG: define void @bar
23; CFG: declare void @baz
24; CFG: IR Dump After {{.*}}bar
25; CFG-NEXT: ModuleID =
26; CFG: define void @foo
27; CFG: define void @bar
28; CFG: declare void @baz
29
30; FOO:      IR Dump After {{Simplify the CFG|SimplifyCFGPass}} {{.*foo}}
31; FOO-NEXT: ModuleID =
32; FOO:   Function Attrs: nounwind ssp
33; FOO: define void @foo
34; FOO:   Function Attrs: nounwind
35; FOO: define void @bar
36; FOO:   Function Attrs: nounwind readnone ssp
37; FOO: declare void @baz
38
39define void @foo() nounwind ssp {
40  call void @baz()
41  ret void
42}
43
44define void @bar() #0 {
45  ret void
46}
47
48declare void @baz() #1
49
50attributes #0 = { nounwind "frame-pointer"="all" }
51
52attributes #1 = { nounwind readnone ssp "use-soft-float"="false" }
53; FOO: attributes #{{[0-9]}} = { nounwind "frame-pointer"="all" }
54
55; FOO: attributes #{{[0-9]}} = { nounwind readnone ssp "use-soft-float"="false" }
56
57; FOO-NOT: IR Dump After {{Simplify the CFG|SimplifyCFGPass}}
58