| 1 |
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s |
| 2 |
|
| 3 |
module { |
| 4 |
func.func @foo_(%arg0: !fir.ref<!fir.array<?x?xi32>> {fir.bindc_name = "a"}, %arg1: !fir.ref<i32> {fir.bindc_name = "n"}, %arg2: !fir.ref<i32> {fir.bindc_name = "m"}, %arg3: !fir.ref<i32> {fir.bindc_name = "p"}) attributes {fir.internal_name = "_QPfoo"} { |
| 5 |
%c5_i32 = arith.constant 5 : i32 |
| 6 |
%c6_i32 = arith.constant 6 : i32 |
| 7 |
%c2 = arith.constant 2 : index |
| 8 |
%c10_i32 = arith.constant 10 : i32 |
| 9 |
%c0 = arith.constant 0 : index |
| 10 |
%c1 = arith.constant 1 : index |
| 11 |
%0 = fir.undefined !fir.dscope |
| 12 |
%1 = fircg.ext_declare %arg1 dummy_scope %0 {uniq_name = "_QFfooEn"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc2) |
| 13 |
%2 = fircg.ext_declare %arg2 dummy_scope %0 {uniq_name = "_QFfooEm"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc3) |
| 14 |
%3 = fircg.ext_declare %arg3 dummy_scope %0 {uniq_name = "_QFfooEp"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc4) |
| 15 |
%4 = fir.load %1 : !fir.ref<i32> |
| 16 |
%5 = fir.convert %4 : (i32) -> index |
| 17 |
%6 = fir.load %2 : !fir.ref<i32> |
| 18 |
%7 = fir.convert %6 : (i32) -> index |
| 19 |
%8 = arith.subi %7, %5 : index |
| 20 |
%9 = arith.addi %8, %c1 : index |
| 21 |
%10 = arith.cmpi sgt, %9, %c0 : index |
| 22 |
%11 = arith.select %10, %9, %c0 : index |
| 23 |
%12 = fir.load %3 : !fir.ref<i32> |
| 24 |
%13 = fir.convert %12 : (i32) -> index |
| 25 |
%14 = arith.cmpi sgt, %13, %c0 : index |
| 26 |
%15 = arith.select %14, %13, %c0 : index |
| 27 |
%16 = fircg.ext_declare %arg0(%11, %15) origin %5, %c1 dummy_scope %0 {uniq_name = "_QFfooEa"} : (!fir.ref<!fir.array<?x?xi32>>, index, index, index, index, !fir.dscope) -> !fir.ref<!fir.array<?x?xi32>> loc(#loc5) |
| 28 |
return |
| 29 |
} loc(#loc1) |
| 30 |
} |
| 31 |
|
| 32 |
#loc1 = loc("test.f90":5:1) |
| 33 |
#loc2 = loc("test.f90":6:11) |
| 34 |
#loc3 = loc("test.f90":7:11) |
| 35 |
#loc4 = loc("test.f90":2:8) |
| 36 |
#loc5 = loc("test.f90":8:11) |
| 37 |
|
| 38 |
// CHECK-DAG: #[[VAR0:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFfooEa3"{{.*}}flags = Artificial> |
| 39 |
// CHECK-DAG: #[[VAR1:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFfooEa1"{{.*}}flags = Artificial> |
| 40 |
// CHECK-DAG: #[[VAR2:.*]] = #llvm.di_local_variable<{{.*}}name = "._QFfooEa2"{{.*}}flags = Artificial> |
| 41 |
// CHECK-DAG: #llvm.di_composite_type<tag = DW_TAG_array_type{{.*}}elements = #llvm.di_subrange<count = #[[VAR1]], lowerBound = #[[VAR0]]>, #llvm.di_subrange<count = #[[VAR2]]>> |