xref: /llvm-project/flang/test/Transforms/debug-assumed-size-array.fir (revision fc4b1a303b296d02f6243a083510c4ee7f290ab0)
1// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s
2
3module attributes {dlti.dl_spec = #dlti.dl_spec<>} {
4  func.func @_QMhelperPfn(%arg0: !fir.ref<!fir.array<5x?xi32>> {fir.bindc_name = "a1"}, %arg1: !fir.ref<!fir.array<?xi32>> {fir.bindc_name = "a2"}, %arg2: !fir.ref<!fir.array<2x?xi32>> {fir.bindc_name = "a3"}) {
5    %c5 = arith.constant 5 : index
6    %c1 = arith.constant 1 : index
7    %c2 = arith.constant 2 : index
8    %c-1 = arith.constant -1 : index
9    %0 = fir.undefined !fir.dscope
10    %1 = fircg.ext_declare %arg0(%c5, %c-1) dummy_scope %0 {uniq_name = "_QMhelperFfnEa1"} : (!fir.ref<!fir.array<5x?xi32>>, index, index, !fir.dscope) -> !fir.ref<!fir.array<5x?xi32>> loc(#loc1)
11    %2 = fircg.ext_declare %arg1(%c-1) origin %c2 dummy_scope %0 {uniq_name = "_QMhelperFfnEa2"} : (!fir.ref<!fir.array<?xi32>>, index, index, !fir.dscope) -> !fir.ref<!fir.array<?xi32>> loc(#loc2)
12    return
13  } loc(#loc3)
14}
15#loc3 = loc("test.f90":1:1)
16#loc1 = loc("test.f90":3:1)
17#loc2 = loc("test.f90":4:1)
18
19// CHECK-DAG: #[[TY1:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}elements = #llvm.di_subrange<count = 5 : i64>, #llvm.di_subrange<>>
20// CHECK-DAG: #[[TY2:.*]] = #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}elements = #llvm.di_subrange<lowerBound = 2 : i64>>
21// CHECK-DAG: #llvm.di_local_variable<{{.*}}name = "a1"{{.*}}type = #[[TY1]]>
22// CHECK-DAG: #llvm.di_local_variable<{{.*}}name = "a2"{{.*}}type = #[[TY2]]>
23