|
1 |
| -// RUN: fir-opt --lower-workshare %s | FileCheck %s |
| 1 | +// RUN: fir-opt --split-input-file --lower-workshare --allow-unregistered-dialect %s | FileCheck %s |
2 | 2 |
|
3 |
| -module { |
4 |
| -// CHECK-LABEL: func.func @simple( |
| 3 | +func.func @wsfunc(%arg0: !fir.ref<!fir.array<42xi32>>) { |
| 4 | + omp.parallel { |
| 5 | + omp.workshare { |
| 6 | + %c42 = arith.constant 42 : index |
| 7 | + %c1_i32 = arith.constant 1 : i32 |
| 8 | + %0 = fir.shape %c42 : (index) -> !fir.shape<1> |
| 9 | + %1:2 = hlfir.declare %arg0(%0) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) |
| 10 | + %2 = fir.allocmem !fir.array<42xi32> {bindc_name = ".tmp.array", uniq_name = ""} |
| 11 | + %3:2 = hlfir.declare %2(%0) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) |
| 12 | + %true = arith.constant true |
| 13 | + %c1 = arith.constant 1 : index |
| 14 | + "omp.workshare_loop_wrapper"() ({ |
| 15 | + omp.loop_nest (%arg1) : index = (%c1) to (%c42) inclusive step (%c1) { |
| 16 | + %7 = hlfir.designate %1#0 (%arg1) : (!fir.ref<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
| 17 | + %8 = fir.load %7 : !fir.ref<i32> |
| 18 | + %9 = arith.subi %8, %c1_i32 : i32 |
| 19 | + %10 = hlfir.designate %3#0 (%arg1) : (!fir.heap<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
| 20 | + hlfir.assign %9 to %10 temporary_lhs : i32, !fir.ref<i32> |
| 21 | + omp.yield |
| 22 | + } |
| 23 | + omp.terminator |
| 24 | + }) : () -> () |
| 25 | + %4 = fir.undefined tuple<!fir.heap<!fir.array<42xi32>>, i1> |
| 26 | + %5 = fir.insert_value %4, %true, [1 : index] : (tuple<!fir.heap<!fir.array<42xi32>>, i1>, i1) -> tuple<!fir.heap<!fir.array<42xi32>>, i1> |
| 27 | + %6 = fir.insert_value %5, %3#0, [0 : index] : (tuple<!fir.heap<!fir.array<42xi32>>, i1>, !fir.heap<!fir.array<42xi32>>) -> tuple<!fir.heap<!fir.array<42xi32>>, i1> |
| 28 | + hlfir.assign %3#0 to %1#0 : !fir.heap<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>> |
| 29 | + fir.freemem %3#0 : !fir.heap<!fir.array<42xi32>> |
| 30 | + omp.terminator |
| 31 | + } |
| 32 | + omp.terminator |
| 33 | + } |
| 34 | + return |
| 35 | +} |
| 36 | + |
| 37 | + |
| 38 | +// ----- |
| 39 | + |
| 40 | +func.func @wsfunc(%arg0: !fir.ref<!fir.array<42xi32>>) { |
| 41 | + omp.workshare { |
| 42 | + %c1_i32 = arith.constant 1 : i32 |
| 43 | + %alloc = fir.alloca i32 |
| 44 | + fir.store %c1_i32 to %alloc : !fir.ref<i32> |
| 45 | + %c42 = arith.constant 42 : index |
| 46 | + %0 = fir.shape %c42 : (index) -> !fir.shape<1> |
| 47 | + %1:2 = hlfir.declare %arg0(%0) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) |
| 48 | + %2 = fir.allocmem !fir.array<42xi32> {bindc_name = ".tmp.array", uniq_name = ""} |
| 49 | + %3:2 = hlfir.declare %2(%0) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) |
| 50 | + %true = arith.constant true |
| 51 | + %c1 = arith.constant 1 : index |
| 52 | + "omp.workshare_loop_wrapper"() ({ |
| 53 | + omp.loop_nest (%arg1) : index = (%c1) to (%c42) inclusive step (%c1) { |
| 54 | + %7 = hlfir.designate %1#0 (%arg1) : (!fir.ref<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
| 55 | + %8 = fir.load %7 : !fir.ref<i32> |
| 56 | + %ld = fir.load %alloc : !fir.ref<i32> |
| 57 | + %n8 = arith.subi %8, %ld : i32 |
| 58 | + %9 = arith.subi %n8, %c1_i32 : i32 |
| 59 | + %10 = hlfir.designate %3#0 (%arg1) : (!fir.heap<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
| 60 | + hlfir.assign %9 to %10 temporary_lhs : i32, !fir.ref<i32> |
| 61 | + omp.yield |
| 62 | + } |
| 63 | + omp.terminator |
| 64 | + }) : () -> () |
| 65 | + %4 = fir.undefined tuple<!fir.heap<!fir.array<42xi32>>, i1> |
| 66 | + %5 = fir.insert_value %4, %true, [1 : index] : (tuple<!fir.heap<!fir.array<42xi32>>, i1>, i1) -> tuple<!fir.heap<!fir.array<42xi32>>, i1> |
| 67 | + %6 = fir.insert_value %5, %3#0, [0 : index] : (tuple<!fir.heap<!fir.array<42xi32>>, i1>, !fir.heap<!fir.array<42xi32>>) -> tuple<!fir.heap<!fir.array<42xi32>>, i1> |
| 68 | + "test.test1"(%alloc) : (!fir.ref<i32>) -> () |
| 69 | + hlfir.assign %3#0 to %1#0 : !fir.heap<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>> |
| 70 | + fir.freemem %3#0 : !fir.heap<!fir.array<42xi32>> |
| 71 | + omp.terminator |
| 72 | + } |
| 73 | + return |
| 74 | +} |
| 75 | + |
| 76 | + |
| 77 | +// CHECK-LABEL: func.func private @_workshare_copy_heap_42xi32( |
| 78 | +// CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.heap<!fir.array<42xi32>>>, |
| 79 | +// CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<!fir.heap<!fir.array<42xi32>>>) { |
| 80 | +// CHECK: return |
| 81 | +// CHECK: } |
| 82 | + |
| 83 | +// CHECK-LABEL: func.func @wsfunc( |
5 | 84 | // CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<42xi32>>) {
|
6 | 85 | // CHECK: %[[VAL_1:.*]] = arith.constant 1 : index
|
7 | 86 | // CHECK: %[[VAL_2:.*]] = arith.constant 1 : i32
|
8 | 87 | // CHECK: %[[VAL_3:.*]] = arith.constant 42 : index
|
9 |
| -// CHECK: %[[VAL_4:.*]] = llvm.mlir.constant(1 : i32) : i32 |
10 |
| -// CHECK: %[[VAL_5:.*]] = llvm.alloca %[[VAL_4]] x !llvm.ptr : (i32) -> !llvm.ptr |
11 |
| -// CHECK: %[[VAL_6:.*]] = fir.alloca !fir.heap<!fir.array<42xi32>> |
| 88 | +// CHECK: %[[VAL_4:.*]] = arith.constant true |
12 | 89 | // CHECK: omp.parallel {
|
13 |
| -// CHECK: omp.single { |
14 |
| -// CHECK: %[[VAL_7:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> |
15 |
| -// CHECK: %[[VAL_8:.*]]:2 = hlfir.declare %[[VAL_0]](%[[VAL_7]]) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) |
16 |
| -// CHECK: %[[VAL_9:.*]] = builtin.unrealized_conversion_cast %[[VAL_8]]#0 : !fir.ref<!fir.array<42xi32>> to !llvm.ptr |
17 |
| -// CHECK: llvm.store %[[VAL_9]], %[[VAL_5]] : !llvm.ptr, !llvm.ptr |
18 |
| -// CHECK: %[[VAL_10:.*]] = fir.allocmem !fir.array<42xi32> {bindc_name = ".tmp.array", uniq_name = ""} |
19 |
| -// CHECK: %[[VAL_11:.*]]:2 = hlfir.declare %[[VAL_10]](%[[VAL_7]]) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) |
20 |
| -// CHECK: fir.store %[[VAL_11]]#0 to %[[VAL_6]] : !fir.ref<!fir.heap<!fir.array<42xi32>>> |
| 90 | +// CHECK: fir.if %[[VAL_4]] { |
| 91 | +// CHECK: %[[VAL_5:.*]] = fir.alloca !fir.heap<!fir.array<42xi32>> |
| 92 | +// CHECK: omp.single copyprivate(%[[VAL_5]] -> @_workshare_copy_heap_42xi32 : !fir.ref<!fir.heap<!fir.array<42xi32>>>) { |
| 93 | +// CHECK: %[[VAL_6:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> |
| 94 | +// CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_0]](%[[VAL_6]]) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) |
| 95 | +// CHECK: %[[VAL_8:.*]] = fir.allocmem !fir.array<42xi32> {bindc_name = ".tmp.array", uniq_name = ""} |
| 96 | +// CHECK: fir.store %[[VAL_8]] to %[[VAL_5]] : !fir.ref<!fir.heap<!fir.array<42xi32>>> |
| 97 | +// CHECK: %[[VAL_9:.*]]:2 = hlfir.declare %[[VAL_8]](%[[VAL_6]]) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) |
| 98 | +// CHECK: omp.terminator |
| 99 | +// CHECK: } |
| 100 | +// CHECK: %[[VAL_10:.*]] = fir.shape %[[VAL_3]] : (index) -> !fir.shape<1> |
| 101 | +// CHECK: %[[VAL_11:.*]]:2 = hlfir.declare %[[VAL_0]](%[[VAL_10]]) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) |
| 102 | +// CHECK: %[[VAL_12:.*]] = fir.load %[[VAL_5]] : !fir.ref<!fir.heap<!fir.array<42xi32>>> |
| 103 | +// CHECK: %[[VAL_13:.*]]:2 = hlfir.declare %[[VAL_12]](%[[VAL_10]]) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) |
| 104 | +// CHECK: omp.wsloop { |
| 105 | +// CHECK: omp.loop_nest (%[[VAL_14:.*]]) : index = (%[[VAL_1]]) to (%[[VAL_3]]) inclusive step (%[[VAL_1]]) { |
| 106 | +// CHECK: %[[VAL_15:.*]] = hlfir.designate %[[VAL_11]]#0 (%[[VAL_14]]) : (!fir.ref<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
| 107 | +// CHECK: %[[VAL_16:.*]] = fir.load %[[VAL_15]] : !fir.ref<i32> |
| 108 | +// CHECK: %[[VAL_17:.*]] = arith.subi %[[VAL_16]], %[[VAL_2]] : i32 |
| 109 | +// CHECK: %[[VAL_18:.*]] = hlfir.designate %[[VAL_13]]#0 (%[[VAL_14]]) : (!fir.heap<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
| 110 | +// CHECK: hlfir.assign %[[VAL_17]] to %[[VAL_18]] temporary_lhs : i32, !fir.ref<i32> |
| 111 | +// CHECK: omp.yield |
| 112 | +// CHECK: } |
| 113 | +// CHECK: omp.terminator |
| 114 | +// CHECK: } |
| 115 | +// CHECK: omp.single nowait { |
| 116 | +// CHECK: hlfir.assign %[[VAL_13]]#0 to %[[VAL_11]]#0 : !fir.heap<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>> |
| 117 | +// CHECK: fir.freemem %[[VAL_13]]#0 : !fir.heap<!fir.array<42xi32>> |
| 118 | +// CHECK: omp.terminator |
| 119 | +// CHECK: } |
| 120 | +// CHECK: omp.barrier |
| 121 | +// CHECK: } |
| 122 | +// CHECK: omp.terminator |
| 123 | +// CHECK: } |
| 124 | +// CHECK: return |
| 125 | +// CHECK: } |
| 126 | + |
| 127 | +// CHECK-LABEL: func.func private @_workshare_copy_heap_42xi32( |
| 128 | +// CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.heap<!fir.array<42xi32>>>, |
| 129 | +// CHECK-SAME: %[[VAL_1:.*]]: !fir.ref<!fir.heap<!fir.array<42xi32>>>) { |
| 130 | +// CHECK: return |
| 131 | +// CHECK: } |
| 132 | + |
| 133 | +// CHECK-LABEL: func.func private @_workshare_copy_llvm_ptr( |
| 134 | +// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr, |
| 135 | +// CHECK-SAME: %[[VAL_1:.*]]: !llvm.ptr) { |
| 136 | +// CHECK: return |
| 137 | +// CHECK: } |
| 138 | + |
| 139 | +// CHECK-LABEL: func.func @wsfunc( |
| 140 | +// CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<42xi32>>) { |
| 141 | +// CHECK: %[[VAL_1:.*]] = arith.constant 1 : index |
| 142 | +// CHECK: %[[VAL_2:.*]] = arith.constant 42 : index |
| 143 | +// CHECK: %[[VAL_3:.*]] = arith.constant 1 : i32 |
| 144 | +// CHECK: %[[VAL_4:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 145 | +// CHECK: %[[VAL_5:.*]] = arith.constant true |
| 146 | +// CHECK: fir.if %[[VAL_5]] { |
| 147 | +// CHECK: %[[VAL_6:.*]] = llvm.alloca %[[VAL_4]] x !llvm.ptr : (i32) -> !llvm.ptr |
| 148 | +// CHECK: %[[VAL_7:.*]] = fir.alloca !fir.heap<!fir.array<42xi32>> |
| 149 | +// CHECK: omp.single copyprivate(%[[VAL_6]] -> @_workshare_copy_llvm_ptr : !llvm.ptr, %[[VAL_7]] -> @_workshare_copy_heap_42xi32 : !fir.ref<!fir.heap<!fir.array<42xi32>>>) { |
| 150 | +// CHECK: %[[VAL_8:.*]] = fir.alloca i32 |
| 151 | +// CHECK: %[[VAL_9:.*]] = builtin.unrealized_conversion_cast %[[VAL_8]] : !fir.ref<i32> to !llvm.ptr |
| 152 | +// CHECK: llvm.store %[[VAL_9]], %[[VAL_6]] : !llvm.ptr, !llvm.ptr |
| 153 | +// CHECK: fir.store %[[VAL_3]] to %[[VAL_8]] : !fir.ref<i32> |
| 154 | +// CHECK: %[[VAL_10:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1> |
| 155 | +// CHECK: %[[VAL_11:.*]]:2 = hlfir.declare %[[VAL_0]](%[[VAL_10]]) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) |
| 156 | +// CHECK: %[[VAL_12:.*]] = fir.allocmem !fir.array<42xi32> {bindc_name = ".tmp.array", uniq_name = ""} |
| 157 | +// CHECK: fir.store %[[VAL_12]] to %[[VAL_7]] : !fir.ref<!fir.heap<!fir.array<42xi32>>> |
| 158 | +// CHECK: %[[VAL_13:.*]]:2 = hlfir.declare %[[VAL_12]](%[[VAL_10]]) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) |
21 | 159 | // CHECK: omp.terminator
|
22 | 160 | // CHECK: }
|
23 |
| -// CHECK: %[[VAL_12:.*]] = llvm.load %[[VAL_5]] : !llvm.ptr -> !llvm.ptr |
24 |
| -// CHECK: %[[VAL_13:.*]] = builtin.unrealized_conversion_cast %[[VAL_12]] : !llvm.ptr to !fir.ref<!fir.array<42xi32>> |
25 |
| -// CHECK: %[[VAL_14:.*]] = fir.load %[[VAL_6]] : !fir.ref<!fir.heap<!fir.array<42xi32>>> |
| 161 | +// CHECK: %[[VAL_14:.*]] = llvm.load %[[VAL_6]] : !llvm.ptr -> !llvm.ptr |
| 162 | +// CHECK: %[[VAL_15:.*]] = builtin.unrealized_conversion_cast %[[VAL_14]] : !llvm.ptr to !fir.ref<i32> |
| 163 | +// CHECK: %[[VAL_16:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1> |
| 164 | +// CHECK: %[[VAL_17:.*]]:2 = hlfir.declare %[[VAL_0]](%[[VAL_16]]) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) |
| 165 | +// CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_7]] : !fir.ref<!fir.heap<!fir.array<42xi32>>> |
| 166 | +// CHECK: %[[VAL_19:.*]]:2 = hlfir.declare %[[VAL_18]](%[[VAL_16]]) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) |
26 | 167 | // CHECK: omp.wsloop {
|
27 |
| -// CHECK: omp.loop_nest (%[[VAL_15:.*]]) : index = (%[[VAL_1]]) to (%[[VAL_3]]) inclusive step (%[[VAL_1]]) { |
28 |
| -// CHECK: %[[VAL_16:.*]] = hlfir.designate %[[VAL_13]] (%[[VAL_15]]) : (!fir.ref<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
29 |
| -// CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref<i32> |
30 |
| -// CHECK: %[[VAL_18:.*]] = arith.subi %[[VAL_17]], %[[VAL_2]] : i32 |
31 |
| -// CHECK: %[[VAL_19:.*]] = hlfir.designate %[[VAL_14]] (%[[VAL_15]]) : (!fir.heap<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
32 |
| -// CHECK: hlfir.assign %[[VAL_18]] to %[[VAL_19]] temporary_lhs : i32, !fir.ref<i32> |
| 168 | +// CHECK: omp.loop_nest (%[[VAL_20:.*]]) : index = (%[[VAL_1]]) to (%[[VAL_2]]) inclusive step (%[[VAL_1]]) { |
| 169 | +// CHECK: %[[VAL_21:.*]] = hlfir.designate %[[VAL_17]]#0 (%[[VAL_20]]) : (!fir.ref<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
| 170 | +// CHECK: %[[VAL_22:.*]] = fir.load %[[VAL_21]] : !fir.ref<i32> |
| 171 | +// CHECK: %[[VAL_23:.*]] = fir.load %[[VAL_15]] : !fir.ref<i32> |
| 172 | +// CHECK: %[[VAL_24:.*]] = arith.subi %[[VAL_22]], %[[VAL_23]] : i32 |
| 173 | +// CHECK: %[[VAL_25:.*]] = arith.subi %[[VAL_24]], %[[VAL_3]] : i32 |
| 174 | +// CHECK: %[[VAL_26:.*]] = hlfir.designate %[[VAL_19]]#0 (%[[VAL_20]]) : (!fir.heap<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
| 175 | +// CHECK: hlfir.assign %[[VAL_25]] to %[[VAL_26]] temporary_lhs : i32, !fir.ref<i32> |
33 | 176 | // CHECK: omp.yield
|
34 | 177 | // CHECK: }
|
35 | 178 | // CHECK: omp.terminator
|
36 | 179 | // CHECK: }
|
37 | 180 | // CHECK: omp.single nowait {
|
38 |
| -// CHECK: hlfir.assign %[[VAL_14]] to %[[VAL_13]] : !fir.heap<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>> |
39 |
| -// CHECK: fir.freemem %[[VAL_14]] : !fir.heap<!fir.array<42xi32>> |
| 181 | +// CHECK: "test.test1"(%[[VAL_15]]) : (!fir.ref<i32>) -> () |
| 182 | +// CHECK: hlfir.assign %[[VAL_19]]#0 to %[[VAL_17]]#0 : !fir.heap<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>> |
| 183 | +// CHECK: fir.freemem %[[VAL_19]]#0 : !fir.heap<!fir.array<42xi32>> |
40 | 184 | // CHECK: omp.terminator
|
41 | 185 | // CHECK: }
|
42 | 186 | // CHECK: omp.barrier
|
43 |
| -// CHECK: omp.terminator |
44 | 187 | // CHECK: }
|
45 | 188 | // CHECK: return
|
46 | 189 | // CHECK: }
|
47 |
| - func.func @simple(%arg0: !fir.ref<!fir.array<42xi32>>) { |
48 |
| - omp.parallel { |
49 |
| - omp.workshare { |
50 |
| - %c42 = arith.constant 42 : index |
51 |
| - %c1_i32 = arith.constant 1 : i32 |
52 |
| - %0 = fir.shape %c42 : (index) -> !fir.shape<1> |
53 |
| - %1:2 = hlfir.declare %arg0(%0) {uniq_name = "array"} : (!fir.ref<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>>) |
54 |
| - %2 = fir.allocmem !fir.array<42xi32> {bindc_name = ".tmp.array", uniq_name = ""} |
55 |
| - %3:2 = hlfir.declare %2(%0) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<42xi32>>, !fir.shape<1>) -> (!fir.heap<!fir.array<42xi32>>, !fir.heap<!fir.array<42xi32>>) |
56 |
| - %true = arith.constant true |
57 |
| - %c1 = arith.constant 1 : index |
58 |
| - "omp.workshare_loop_wrapper"() ({ |
59 |
| - omp.loop_nest (%arg1) : index = (%c1) to (%c42) inclusive step (%c1) { |
60 |
| - %7 = hlfir.designate %1#0 (%arg1) : (!fir.ref<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
61 |
| - %8 = fir.load %7 : !fir.ref<i32> |
62 |
| - %9 = arith.subi %8, %c1_i32 : i32 |
63 |
| - %10 = hlfir.designate %3#0 (%arg1) : (!fir.heap<!fir.array<42xi32>>, index) -> !fir.ref<i32> |
64 |
| - hlfir.assign %9 to %10 temporary_lhs : i32, !fir.ref<i32> |
65 |
| - omp.yield |
66 |
| - } |
67 |
| - omp.terminator |
68 |
| - }) : () -> () |
69 |
| - %4 = fir.undefined tuple<!fir.heap<!fir.array<42xi32>>, i1> |
70 |
| - %5 = fir.insert_value %4, %true, [1 : index] : (tuple<!fir.heap<!fir.array<42xi32>>, i1>, i1) -> tuple<!fir.heap<!fir.array<42xi32>>, i1> |
71 |
| - %6 = fir.insert_value %5, %3#0, [0 : index] : (tuple<!fir.heap<!fir.array<42xi32>>, i1>, !fir.heap<!fir.array<42xi32>>) -> tuple<!fir.heap<!fir.array<42xi32>>, i1> |
72 |
| - hlfir.assign %3#0 to %1#0 : !fir.heap<!fir.array<42xi32>>, !fir.ref<!fir.array<42xi32>> |
73 |
| - fir.freemem %3#0 : !fir.heap<!fir.array<42xi32>> |
74 |
| - omp.terminator |
75 |
| - } |
76 |
| - omp.terminator |
77 |
| - } |
78 |
| - return |
79 |
| - } |
80 |
| -} |
| 190 | + |
0 commit comments