| 1 |
// RUN: fir-opt --add-debug-info --mlir-print-debuginfo %s | FileCheck %s |
| 2 |
|
| 3 |
module attributes {dlti.dl_spec = #dlti.dl_spec<>} { |
| 4 |
func.func @fn_(%arg0: !fir.ref<!fir.array<?x?xi32>> {fir.bindc_name = "b"}, %arg1: !fir.ref<i32> {fir.bindc_name = "c"}, %arg2: !fir.ref<i32> {fir.bindc_name = "d"}) { |
| 5 |
%c1 = arith.constant 1 : index |
| 6 |
%c0 = arith.constant 0 : index |
| 7 |
%0 = fir.alloca i32 |
| 8 |
%1 = fir.alloca i32 |
| 9 |
%2 = fir.undefined !fir.dscope |
| 10 |
%3 = fircg.ext_declare %arg1 dummy_scope %2 {uniq_name = "_QFfnEc"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc2) |
| 11 |
%4 = fircg.ext_declare %arg2 dummy_scope %2 {uniq_name = "_QFfnEd"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> loc(#loc3) |
| 12 |
%5 = fir.load %3 : !fir.ref<i32> |
| 13 |
%6 = fir.convert %5 : (i32) -> index |
| 14 |
%9 = fir.load %4 : !fir.ref<i32> |
| 15 |
%10 = fir.convert %9 : (i32) -> index |
| 16 |
%15 = fircg.ext_declare %arg0(%6, %10) dummy_scope %2 {uniq_name = "_QFfnEb"} : (!fir.ref<!fir.array<?x?xi32>>, index, index, !fir.dscope) -> !fir.ref<!fir.array<?x?xi32>> loc(#loc4) |
| 17 |
%16 = fircg.ext_embox %15(%6, %10) : (!fir.ref<!fir.array<?x?xi32>>, index, index) -> !fir.box<!fir.array<?x?xi32>> |
| 18 |
%17:3 = fir.box_dims %16, %c0 : (!fir.box<!fir.array<?x?xi32>>, index) -> (index, index, index) |
| 19 |
%18 = arith.subi %17#1, %c1 : index |
| 20 |
%19 = omp.map.bounds lower_bound(%c0 : index) upper_bound(%18 : index) extent(%17#1 : index) stride(%17#2 : index) start_idx(%c1 : index) {stride_in_bytes = true} |
| 21 |
%20 = arith.muli %17#2, %17#1 : index |
| 22 |
%21:3 = fir.box_dims %16, %c1 : (!fir.box<!fir.array<?x?xi32>>, index) -> (index, index, index) |
| 23 |
%22 = arith.subi %21#1, %c1 : index |
| 24 |
%23 = omp.map.bounds lower_bound(%c0 : index) upper_bound(%22 : index) extent(%21#1 : index) stride(%20 : index) start_idx(%c1 : index) {stride_in_bytes = true} |
| 25 |
%24 = omp.map.info var_ptr(%15 : !fir.ref<!fir.array<?x?xi32>>, i32) map_clauses(tofrom) capture(ByRef) bounds(%19, %23) -> !fir.ref<!fir.array<?x?xi32>> {name = "b"} |
| 26 |
%25 = omp.map.info var_ptr(%1 : !fir.ref<i32>, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref<i32> {name = ""} |
| 27 |
%26 = omp.map.info var_ptr(%0 : !fir.ref<i32>, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) -> !fir.ref<i32> {name = ""} |
| 28 |
omp.target map_entries(%24 -> %arg3, %25 -> %arg4, %26 -> %arg5 : !fir.ref<!fir.array<?x?xi32>>, !fir.ref<i32>, !fir.ref<i32>) { |
| 29 |
%27 = fir.load %arg5 : !fir.ref<i32> |
| 30 |
%28 = fir.load %arg4 : !fir.ref<i32> |
| 31 |
%29 = fir.convert %27 : (i32) -> index |
| 32 |
%31 = fir.convert %28 : (i32) -> index |
| 33 |
%37 = fircg.ext_declare %arg3(%29, %31) {uniq_name = "_QFfnEb"} : (!fir.ref<!fir.array<?x?xi32>>, index, index) -> !fir.ref<!fir.array<?x?xi32>> loc(#loc5) |
| 34 |
omp.terminator |
| 35 |
} loc(#loc6) |
| 36 |
return |
| 37 |
} loc(#loc7) |
| 38 |
} |
| 39 |
#loc1 = loc("test.f90":1:1) |
| 40 |
#loc2 = loc("test.f90":3:1) |
| 41 |
#loc3 = loc("test.f90":7:1) |
| 42 |
#loc4 = loc("test.f90":8:1) |
| 43 |
#loc5 = loc("test.f90":6:1) |
| 44 |
#loc6 = loc("test.f90":16:1) |
| 45 |
#loc7 = loc("test.f90":26:1) |
| 46 |
|
| 47 |
|
| 48 |
// Test that variable size arrays inside target regions get their own |
| 49 |
// compiler generated variables for size. |
| 50 |
|
| 51 |
// CHECK: #[[SP:.*]] = #llvm.di_subprogram<{{.*}}name = "__omp_offloading_{{.*}}_fn__l16"{{.*}}> |
| 52 |
// CHECK: #llvm.di_local_variable<scope = #[[SP]], name = "._QFfnEb1"{{.*}}> |
| 53 |
// CHECK: #llvm.di_local_variable<scope = #[[SP]], name = "._QFfnEb2"{{.*}}> |