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 -enable-new-pm=0 -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 -enable-new-pm=0 -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 -enable-new-pm=0 -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-COUNT-3: 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: OpenMP specific optimizations
50 ; CHECK-O2-NEXT: Deduce function attributes
51 ; Next up is the main function pass pipeline. It shouldn't be split up and
52 ; should contain the main loop pass pipeline as well.
53 ; CHECK-O2-NEXT: FunctionPass Manager
54 ; CHECK-O2-NOT: Manager
55 ; CHECK-O2: Loop Pass Manager
56 ; CHECK-O2-NOT: Manager
57 ; FIXME: We shouldn't be pulling out to simplifycfg and instcombine and
58 ; causing new loop pass managers.
59 ; CHECK-O2: Simplify the CFG
60 ; CHECK-O2-NOT: Manager
61 ; CHECK-O2: Combine redundant instructions
62 ; CHECK-O2-NOT: Manager
63 ; CHECK-O2: Loop Pass Manager
64 ; CHECK-O2-NOT: Manager
65 ; FIXME: It isn't clear that we need yet another loop pass pipeline
66 ; and run of LICM here.
67 ; CHECK-O2-NOT: Manager
68 ; CHECK-O2: Loop Pass Manager
69 ; CHECK-O2-NEXT: Loop Invariant Code Motion
70 ; CHECK-O2-NOT: Manager
71 ; Next we break out of the main Function passes inside the CGSCC pipeline with
73 ; CHECK-O2: A No-Op Barrier Pass
74 ; CHECK-O2-NEXT: Eliminate Available Externally
75 ; Inferring function attribute should be right after the CGSCC pipeline, before
76 ; any other optimizations/analyses.
77 ; CHECK-O2-NEXT: CallGraph
78 ; CHECK-O2-NEXT: Deduce function attributes in RPO
79 ; CHECK-O2-NOT: Manager
80 ; Reduce the size of the IR ASAP after the inliner.
81 ; CHECK-O2-NEXT: Global Variable Optimizer
82 ; CHECK-O2: Dead Global Elimination
83 ; Next is the late function pass pipeline.
84 ; CHECK-O2: FunctionPass Manager
85 ; CHECK-O2-NOT: Manager
86 ; We rotate loops prior to vectorization.
87 ; CHECK-O2: Loop Pass Manager
88 ; CHECK-O2-NEXT: Rotate Loops
89 ; CHECK-O2-NOT: Manager
90 ; CHECK-O2: Loop Vectorization
91 ; CHECK-O2-NOT: Manager
92 ; CHECK-O2: SLP Vectorizer
93 ; CHECK-O2-NOT: Manager
94 ; After vectorization we do partial unrolling.
95 ; CHECK-O2: Loop Pass Manager
96 ; CHECK-O2-NEXT: Unroll loops
97 ; CHECK-O2-NOT: Manager
98 ; After vectorization and unrolling we try to do any cleanup of inserted code,
99 ; including a run of LICM. This shouldn't run in the same loop pass manager as
100 ; the runtime unrolling though.
101 ; CHECK-O2: Loop Pass Manager
102 ; CHECK-O2-NEXT: Loop Invariant Code Motion
103 ; SPLIT: Hot Cold Splitting
104 ; CHECK-O2: FunctionPass Manager
105 ; CHECK-O2: Loop Pass Manager
106 ; CHECK-O2-NEXT: Loop Sink
107 ; CHECK-O2: Simplify the CFG
108 ; CHECK-O2-NOT: Manager
110 ; FIXME: There really shouldn't be another pass manager, especially one that
111 ; just builds the domtree. It doesn't even run the verifier.
112 ; CHECK-O2: Pass Arguments:
113 ; CHECK-O2: FunctionPass Manager
114 ; CHECK-O2-NEXT: Dominator Tree Construction