1 ! Test the MLIR pass pipeline
3 ! RUN: %flang_fc1 -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline -o /dev/null %s 2>&1 | FileCheck --check-prefixes=ALL %s
5 ! RUN: %flang_fc1 -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -O0 -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL %s
6 ! RUN: %flang_fc1 -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -O2 -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL,O2 %s
12 ! ALL: Pass statistics report
13 ! ALL: Fortran::lower::VerifierPass
15 ! ALL: Pass statistics report
17 ! ALL: Fortran::lower::VerifierPass
18 ! O2-NEXT: Canonicalizer
19 ! ALL: Pipeline Collection : ['fir.global', 'func.func', 'omp.declare_reduction', 'omp.private']
20 ! ALL-NEXT:'fir.global' Pipeline
21 ! O2-NEXT: SimplifyHLFIRIntrinsics
22 ! ALL: InlineElementals
23 ! ALL-NEXT:'func.func' Pipeline
24 ! O2-NEXT: SimplifyHLFIRIntrinsics
25 ! ALL: InlineElementals
26 ! ALL-NEXT:'omp.declare_reduction' Pipeline
27 ! O2-NEXT: SimplifyHLFIRIntrinsics
28 ! ALL: InlineElementals
29 ! ALL-NEXT:'omp.private' Pipeline
30 ! O2-NEXT: SimplifyHLFIRIntrinsics
31 ! ALL: InlineElementals
32 ! O2-NEXT: Canonicalizer
34 ! O2-NEXT: (S) {{.*}} num-cse'd
35 ! O2-NEXT: (S) {{.*}} num-dce'd
36 ! O2-NEXT: Pipeline Collection : ['fir.global', 'func.func', 'omp.declare_reduction', 'omp.private']
37 ! O2-NEXT: 'fir.global' Pipeline
38 ! O2-NEXT: OptimizedBufferization
39 ! O2-NEXT: 'func.func' Pipeline
40 ! O2-NEXT: OptimizedBufferization
41 ! O2-NEXT: 'omp.declare_reduction' Pipeline
42 ! O2-NEXT: OptimizedBufferization
43 ! O2-NEXT: 'omp.private' Pipeline
44 ! O2-NEXT: OptimizedBufferization
45 ! ALL: LowerHLFIROrderedAssignments
46 ! ALL-NEXT: LowerHLFIRIntrinsics
47 ! ALL-NEXT: BufferizeHLFIR
48 ! ALL-NEXT: ConvertHLFIRtoFIR
50 ! Ideally, we need an output with only the pass names, but
51 ! there is currently no way to get that, so in order to
52 ! guarantee that the passes are in the expected order
53 ! (i.e. use -NEXT) we have to check the statistics output as well.
54 ! ALL-NEXT: (S) 0 num-cse'd - Number of operations CSE'd
55 ! ALL-NEXT: (S) 0 num-dce'd - Number of operations DCE'd
57 ! ALL-NEXT: Pipeline Collection : ['fir.global', 'func.func', 'omp.declare_reduction', 'omp.private']
58 ! ALL-NEXT: 'fir.global' Pipeline
59 ! ALL-NEXT: CharacterConversion
60 ! ALL-NEXT: 'func.func' Pipeline
61 ! ALL-NEXT: ArrayValueCopy
62 ! ALL-NEXT: CharacterConversion
63 ! ALL-NEXT: 'omp.declare_reduction' Pipeline
64 ! ALL-NEXT: CharacterConversion
65 ! ALL-NEXT: 'omp.private' Pipeline
66 ! ALL-NEXT: CharacterConversion
68 ! ALL-NEXT: Canonicalizer
69 ! ALL-NEXT: SimplifyRegionLite
70 ! O2-NEXT: SimplifyIntrinsics
71 ! O2-NEXT: AlgebraicSimplification
73 ! ALL-NEXT: (S) 0 num-cse'd - Number of operations CSE'd
74 ! ALL-NEXT: (S) 0 num-dce'd - Number of operations DCE'd
76 ! ALL-NEXT: 'func.func' Pipeline
77 ! ALL-NEXT: MemoryAllocationOpt
80 ! ALL-NEXT: SimplifyRegionLite
82 ! ALL-NEXT: (S) 0 num-cse'd - Number of operations CSE'd
83 ! ALL-NEXT: (S) 0 num-dce'd - Number of operations DCE'd
85 ! ALL-NEXT: PolymorphicOpConversion
86 ! ALL-NEXT: AssumedRankOpConversion
87 ! O2-NEXT: AddAliasTags
89 ! ALL-NEXT: Pipeline Collection : ['fir.global', 'func.func', 'omp.declare_reduction', 'omp.private']
90 ! ALL-NEXT: 'fir.global' Pipeline
91 ! ALL-NEXT: StackReclaim
92 ! ALL-NEXT: CFGConversion
93 ! ALL-NEXT: 'func.func' Pipeline
94 ! ALL-NEXT: StackReclaim
95 ! ALL-NEXT: CFGConversion
96 ! ALL-NEXT: 'omp.declare_reduction' Pipeline
97 ! ALL-NEXT: StackReclaim
98 ! ALL-NEXT: CFGConversion
99 ! ALL-NEXT: 'omp.private' Pipeline
100 ! ALL-NEXT: StackReclaim
101 ! ALL-NEXT: CFGConversion
103 ! ALL-NEXT: SCFToControlFlow
104 ! ALL-NEXT: Canonicalizer
105 ! ALL-NEXT: SimplifyRegionLite
107 ! ALL-NEXT: (S) 0 num-cse'd - Number of operations CSE'd
108 ! ALL-NEXT: (S) 0 num-dce'd - Number of operations DCE'd
109 ! ALL-NEXT: BoxedProcedurePass
111 ! ALL-NEXT: Pipeline Collection : ['fir.global', 'func.func', 'omp.declare_reduction', 'omp.private']
112 ! ALL-NEXT: 'fir.global' Pipeline
113 ! ALL-NEXT: AbstractResultOpt
114 ! ALL-NEXT: 'func.func' Pipeline
115 ! ALL-NEXT: AbstractResultOpt
116 ! ALL-NEXT: 'omp.declare_reduction' Pipeline
117 ! ALL-NEXT: AbstractResultOpt
118 ! ALL-NEXT: 'omp.private' Pipeline
119 ! ALL-NEXT: AbstractResultOpt
121 ! ALL-NEXT: CodeGenRewrite
122 ! ALL-NEXT: (S) 0 num-dce'd - Number of operations eliminated
123 ! ALL-NEXT: ExternalNameConversion
124 ! ALL-NEXT: TargetRewrite
125 ! ALL-NEXT: CompilerGeneratedNamesConversion
126 ! ALL-NEXT: FIRToLLVMLowering
127 ! ALL-NOT: LLVMIRLoweringPass