1! Test the debug pass pipeline 2 3! RUN: %flang -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline -o /dev/null %s 2>&1 | FileCheck --check-prefixes=ALL,NO-DEBUG %s 4 5! RUN: %flang -g0 -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL,NO-DEBUG %s 6! RUN: %flang -g -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL,DEBUG %s 7! RUN: %flang -g1 -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL,DEBUG %s 8! RUN: %flang -gline-tables-only -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL,DEBUG %s 9! RUN: %flang -gline-directives-only -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL,DEBUG,DEBUG-DIRECTIVES %s 10! RUN: %flang -g2 -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL,DEBUG,DEBUG-CONSTRUCT %s 11! RUN: %flang -g3 -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -o /dev/null 2>&1 | FileCheck --check-prefixes=ALL,DEBUG,DEBUG-CONSTRUCT %s 12 13! RUN: not %flang_fc1 -debug-info-kind=invalid -S -mmlir --mlir-pass-statistics -mmlir --mlir-pass-statistics-display=pipeline %s -o /dev/null 2>&1 | FileCheck --check-prefixes=DEBUG-ERR %s 14 15! REQUIRES: asserts 16 17end program 18 19! DEBUG-CONSTRUCT: warning: Unsupported debug option: constructor 20! DEBUG-DIRECTIVES: warning: Unsupported debug option: line-directives-only 21! 22! DEBUG-ERR: error: invalid value 'invalid' in '-debug-info-kind=invalid' 23! DEBUG-ERR-NOT: Pass statistics report 24 25! ALL: Pass statistics report 26! ALL: Fortran::lower::VerifierPass 27 28! ALL: Pass statistics report 29 30! ALL: Fortran::lower::VerifierPass 31! ALL-NEXT: Pipeline Collection : ['fir.global', 'func.func', 'omp.declare_reduction', 'omp.private'] 32! ALL-NEXT: 'fir.global' Pipeline 33! ALL-NEXT: InlineElementals 34! ALL-NEXT: 'func.func' Pipeline 35! ALL-NEXT: InlineElementals 36! ALL-NEXT: 'omp.declare_reduction' Pipeline 37! ALL-NEXT: InlineElementals 38! ALL-NEXT: 'omp.private' Pipeline 39! ALL-NEXT: InlineElementals 40! ALL-NEXT: LowerHLFIROrderedAssignments 41! ALL-NEXT: LowerHLFIRIntrinsics 42! ALL-NEXT: BufferizeHLFIR 43! ALL-NEXT: ConvertHLFIRtoFIR 44! ALL-NEXT: CSE 45! Ideally, we need an output with only the pass names, but 46! there is currently no way to get that, so in order to 47! guarantee that the passes are in the expected order 48! (i.e. use -NEXT) we have to check the statistics output as well. 49! ALL-NEXT: (S) 0 num-cse'd - Number of operations CSE'd 50! ALL-NEXT: (S) 0 num-dce'd - Number of operations DCE'd 51 52! ALL-NEXT: Pipeline Collection : ['fir.global', 'func.func', 'omp.declare_reduction', 'omp.private'] 53! ALL-NEXT: 'fir.global' Pipeline 54! ALL-NEXT: CharacterConversion 55! ALL-NEXT: 'func.func' Pipeline 56! ALL-NEXT: ArrayValueCopy 57! ALL-NEXT: CharacterConversion 58! ALL-NEXT: 'omp.declare_reduction' Pipeline 59! ALL-NEXT: CharacterConversion 60! ALL-NEXT: 'omp.private' Pipeline 61! ALL-NEXT: CharacterConversion 62 63! ALL-NEXT: Canonicalizer 64! ALL-NEXT: SimplifyRegionLite 65! ALL-NEXT: CSE 66! ALL-NEXT: (S) 0 num-cse'd - Number of operations CSE'd 67! ALL-NEXT: (S) 0 num-dce'd - Number of operations DCE'd 68 69! ALL-NEXT: 'func.func' Pipeline 70! ALL-NEXT: MemoryAllocationOpt 71 72! ALL-NEXT: Inliner 73! ALL-NEXT: SimplifyRegionLite 74! ALL-NEXT: CSE 75! ALL-NEXT: (S) 0 num-cse'd - Number of operations CSE'd 76! ALL-NEXT: (S) 0 num-dce'd - Number of operations DCE'd 77 78! ALL-NEXT: PolymorphicOpConversion 79! ALL-NEXT: AssumedRankOpConversion 80 81! ALL-NEXT: Pipeline Collection : ['fir.global', 'func.func', 'omp.declare_reduction', 'omp.private'] 82! ALL-NEXT: 'fir.global' Pipeline 83! ALL-NEXT: StackReclaim 84! ALL-NEXT: CFGConversion 85! ALL-NEXT: 'func.func' Pipeline 86! ALL-NEXT: StackReclaim 87! ALL-NEXT: CFGConversion 88! ALL-NEXT: 'omp.declare_reduction' Pipeline 89! ALL-NEXT: StackReclaim 90! ALL-NEXT: CFGConversion 91! ALL-NEXT: 'omp.private' Pipeline 92! ALL-NEXT: StackReclaim 93! ALL-NEXT: CFGConversion 94! ALL-NEXT: SCFToControlFlow 95! ALL-NEXT: Canonicalizer 96! ALL-NEXT: SimplifyRegionLite 97! ALL-NEXT: CSE 98! ALL-NEXT: (S) 0 num-cse'd - Number of operations CSE'd 99! ALL-NEXT: (S) 0 num-dce'd - Number of operations DCE'd 100! ALL-NEXT: BoxedProcedurePass 101 102! ALL-NEXT: Pipeline Collection : ['fir.global', 'func.func', 'gpu.module', 'omp.declare_reduction', 'omp.private'] 103! ALL-NEXT: 'fir.global' Pipeline 104! ALL-NEXT: AbstractResultOpt 105! ALL-NEXT: 'func.func' Pipeline 106! ALL-NEXT: AbstractResultOpt 107! ALL-NEXT: 'gpu.module' Pipeline 108! ALL-NEXT: Pipeline Collection : ['func.func', 'gpu.func'] 109! ALL-NEXT: 'func.func' Pipeline 110! ALL-NEXT: AbstractResultOpt 111! ALL-NEXT: 'gpu.func' Pipeline 112! ALL-NEXT: AbstractResultOpt 113! ALL-NEXT: 'omp.declare_reduction' Pipeline 114! ALL-NEXT: AbstractResultOpt 115! ALL-NEXT: 'omp.private' Pipeline 116! ALL-NEXT: AbstractResultOpt 117 118! ALL-NEXT: CodeGenRewrite 119! ALL-NEXT: (S) 0 num-dce'd - Number of operations eliminated 120! ALL-NEXT: ExternalNameConversion 121! DEBUG-NEXT: AddDebugInfo 122! NO-DEBUG-NOT: AddDebugInfo 123! ALL-NEXT: TargetRewrite 124! ALL-NEXT: CompilerGeneratedNamesConversion 125! ALL: FIRToLLVMLowering 126! ALL-NOT: LLVMIRLoweringPass 127