1 ; Test the particular pass pipelines have the expected structure. This is
2 ; particularly important in order to check that the implicit scheduling of the
3 ; legacy pass manager doesn't introduce unexpected structural changes in the
6 ; RUN: opt -disable-output -disable-verify -debug-pass=Structure \
8 ; RUN: | FileCheck %s --check-prefix=CHECK-O2
9 ; RUN: llvm-profdata merge %S/Inputs/pass-pipelines.proftext -o %t.profdata
10 ; RUN: opt -disable-output -disable-verify -debug-pass=Structure \
11 ; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
13 ; RUN: | FileCheck %s --check-prefix=CHECK-O2 --check-prefix=PGOUSE
14 ; RUN: opt -disable-output -disable-verify -debug-pass=Structure \
15 ; RUN: -pgo-kind=pgo-instr-use-pipeline -profile-file='%t.profdata' \
16 ; RUN: -hot-cold-split \
18 ; RUN: | FileCheck %s --check-prefix=CHECK-O2 --check-prefix=PGOUSE --check-prefix=SPLIT
20 ; In the first pipeline there should just be a function pass manager, no other
22 ; CHECK-O2: Pass Arguments:
23 ; CHECK-O2-NOT: Manager
24 ; CHECK-O2: FunctionPass Manager
25 ; CHECK-O2-NOT: Manager
27 ; CHECK-O2: Pass Arguments:
28 ; CHECK-O2: ModulePass Manager
29 ; CHECK-O2-NOT: Manager
30 ; First function pass pipeline just does early opts.
31 ; CHECK-O2: FunctionPass Manager
32 ; CHECK-O2-NOT: Manager
33 ; FIXME: It's a bit odd to do dead arg elim in the middle of early opts...
34 ; CHECK-O2: Dead Argument Elimination
35 ; CHECK-O2-NEXT: FunctionPass Manager
36 ; CHECK-O2-NOT: Manager
37 ; Very carefully assert the CGSCC pass pipeline as it is fragile and unusually
38 ; susceptible to phase ordering issues.
39 ; CHECK-O2: CallGraph Construction
40 ; PGOUSE: Call Graph SCC Pass Manager
41 ; PGOUSE: Function Integration/Inlining
42 ; PGOUSE: PGOInstrumentationUsePass
43 ; PGOUSE: PGOIndirectCallPromotion
44 ; PGOUSE: CallGraph Construction
45 ; CHECK-O2-NEXT: Globals Alias Analysis
46 ; CHECK-O2-NEXT: Call Graph SCC Pass Manager
47 ; CHECK-O2-NEXT: Remove unused exception handling info
48 ; CHECK-O2-NEXT: Function Integration/Inlining
49 ; CHECK-O2-NEXT: Deduce function attributes
50 ; Next up is the main function pass pipeline. It shouldn't be split up and
51 ; should contain the main loop pass pipeline as well.
52 ; CHECK-O2-NEXT: FunctionPass Manager
53 ; CHECK-O2-NOT: Manager
54 ; CHECK-O2: Loop Pass Manager
55 ; CHECK-O2-NOT: Manager
56 ; FIXME: We shouldn't be pulling out to simplify-cfg and instcombine and
57 ; causing new loop pass managers.
58 ; CHECK-O2: Simplify the CFG
59 ; CHECK-O2-NOT: Manager
60 ; CHECK-O2: Combine redundant instructions
61 ; CHECK-O2-NOT: Manager
62 ; CHECK-O2: Loop Pass Manager
63 ; CHECK-O2-NOT: Manager
64 ; FIXME: It isn't clear that we need yet another loop pass pipeline
65 ; and run of LICM here.
66 ; CHECK-O2-NOT: Manager
67 ; CHECK-O2: Loop Pass Manager
68 ; CHECK-O2-NEXT: Loop Invariant Code Motion
69 ; CHECK-O2-NOT: Manager
70 ; Next we break out of the main Function passes inside the CGSCC pipeline with
72 ; CHECK-O2: A No-Op Barrier Pass
73 ; CHECK-O2-NEXT: Eliminate Available Externally
74 ; Inferring function attribute should be right after the CGSCC pipeline, before
75 ; any other optimizations/analyses.
76 ; CHECK-O2-NEXT: CallGraph
77 ; CHECK-O2-NEXT: Deduce function attributes in RPO
78 ; CHECK-O2-NOT: Manager
79 ; Reduce the size of the IR ASAP after the inliner.
80 ; CHECK-O2-NEXT: Global Variable Optimizer
81 ; CHECK-O2: Dead Global Elimination
82 ; Next is the late function pass pipeline.
83 ; CHECK-O2: FunctionPass Manager
84 ; CHECK-O2-NOT: Manager
85 ; We rotate loops prior to vectorization.
86 ; CHECK-O2: Loop Pass Manager
87 ; CHECK-O2-NEXT: Rotate Loops
88 ; CHECK-O2-NOT: Manager
89 ; CHECK-O2: Loop Vectorization
90 ; CHECK-O2-NOT: Manager
91 ; CHECK-O2: SLP Vectorizer
92 ; CHECK-O2-NOT: Manager
93 ; After vectorization we do partial unrolling.
94 ; CHECK-O2: Loop Pass Manager
95 ; CHECK-O2-NEXT: Unroll loops
96 ; CHECK-O2-NOT: Manager
97 ; After vectorization and unrolling we try to do any cleanup of inserted code,
98 ; including a run of LICM. This shouldn't run in the same loop pass manager as
99 ; the runtime unrolling though.
100 ; CHECK-O2: Loop Pass Manager
101 ; CHECK-O2-NEXT: Loop Invariant Code Motion
102 ; SPLIT: Hot Cold Splitting
103 ; CHECK-O2: FunctionPass Manager
104 ; CHECK-O2: Loop Pass Manager
105 ; CHECK-O2-NEXT: Loop Sink
106 ; CHECK-O2: Simplify the CFG
107 ; CHECK-O2-NOT: Manager
109 ; FIXME: There really shouldn't be another pass manager, especially one that
110 ; just builds the domtree. It doesn't even run the verifier.
111 ; CHECK-O2: Pass Arguments:
112 ; CHECK-O2: FunctionPass Manager
113 ; CHECK-O2-NEXT: Dominator Tree Construction