| 1 |
! RUN: bbc --emit-fir -hlfir=false %s -o - | FileCheck %s |
| 2 |
! RUN: bbc -hlfir=false %s -o - | FileCheck --check-prefix=PostOpt %s |
| 3 |
|
| 4 |
|
| 5 |
subroutine assumed_size_test(a) |
| 6 |
integer :: a(10,*) |
| 7 |
a(:, 1:2) = a(:, 3:4) |
| 8 |
end subroutine assumed_size_test |
| 9 |
|
| 10 |
subroutine assumed_size_forall_test(b) |
| 11 |
integer :: b(10,*) |
| 12 |
forall (i=2:6) |
| 13 |
b(i, 1:2) = b(i, 3:4) |
| 14 |
end forall |
| 15 |
end subroutine assumed_size_forall_test |
| 16 |
|
| 17 |
! CHECK-LABEL: func @_QPassumed_size_test( |
| 18 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<10x?xi32>>{{.*}}) { |
| 19 |
! CHECK: %[[VAL_1A:.*]] = fir.convert %c10{{.*}} : (i64) -> index |
| 20 |
! CHECK: %[[VAL_1B:.*]] = arith.cmpi sgt, %[[VAL_1A]], %c0{{.*}} : index |
| 21 |
! CHECK: %[[VAL_1:.*]] = arith.select %[[VAL_1B]], %[[VAL_1A]], %c0{{.*}} : index |
| 22 |
! CHECK: %[[VAL_2:.*]] = arith.constant -1 : index |
| 23 |
! CHECK: %[[VAL_3:.*]] = arith.constant 1 : index |
| 24 |
! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i64 |
| 25 |
! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : (i64) -> index |
| 26 |
! CHECK: %[[VAL_6:.*]] = arith.addi %[[VAL_3]], %[[VAL_1]] : index |
| 27 |
! CHECK: %[[VAL_7:.*]] = arith.subi %[[VAL_6]], %[[VAL_3]] : index |
| 28 |
! CHECK: %[[VAL_8:.*]] = arith.constant 0 : index |
| 29 |
! CHECK: %[[VAL_9:.*]] = arith.subi %[[VAL_7]], %[[VAL_3]] : index |
| 30 |
! CHECK: %[[VAL_10:.*]] = arith.addi %[[VAL_9]], %[[VAL_5]] : index |
| 31 |
! CHECK: %[[VAL_11:.*]] = arith.divsi %[[VAL_10]], %[[VAL_5]] : index |
| 32 |
! CHECK: %[[VAL_12:.*]] = arith.cmpi sgt, %[[VAL_11]], %[[VAL_8]] : index |
| 33 |
! CHECK: %[[VAL_13:.*]] = arith.select %[[VAL_12]], %[[VAL_11]], %[[VAL_8]] : index |
| 34 |
! CHECK: %[[VAL_14:.*]] = arith.constant 1 : i64 |
| 35 |
! CHECK: %[[VAL_15:.*]] = fir.convert %[[VAL_14]] : (i64) -> index |
| 36 |
! CHECK: %[[VAL_16:.*]] = arith.constant 1 : i64 |
| 37 |
! CHECK: %[[VAL_17:.*]] = fir.convert %[[VAL_16]] : (i64) -> index |
| 38 |
! CHECK: %[[VAL_18:.*]] = arith.constant 2 : i64 |
| 39 |
! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_18]] : (i64) -> index |
| 40 |
! CHECK: %[[VAL_20:.*]] = arith.constant 0 : index |
| 41 |
! CHECK: %[[VAL_21:.*]] = arith.subi %[[VAL_19]], %[[VAL_15]] : index |
| 42 |
! CHECK: %[[VAL_22:.*]] = arith.addi %[[VAL_21]], %[[VAL_17]] : index |
| 43 |
! CHECK: %[[VAL_23:.*]] = arith.divsi %[[VAL_22]], %[[VAL_17]] : index |
| 44 |
! CHECK: %[[VAL_24:.*]] = arith.cmpi sgt, %[[VAL_23]], %[[VAL_20]] : index |
| 45 |
! CHECK: %[[VAL_25:.*]] = arith.select %[[VAL_24]], %[[VAL_23]], %[[VAL_20]] : index |
| 46 |
! CHECK: %[[VAL_26:.*]] = fir.shape %[[VAL_1]], %[[VAL_2]] : (index, index) -> !fir.shape<2> |
| 47 |
! CHECK: %[[VAL_27:.*]] = fir.slice %[[VAL_3]], %[[VAL_7]], %[[VAL_5]], %[[VAL_15]], %[[VAL_19]], %[[VAL_17]] : (index, index, index, index, index, index) -> !fir.slice<2> |
| 48 |
! CHECK: %[[VAL_28:.*]] = fir.array_load %[[VAL_0]](%[[VAL_26]]) {{\[}}%[[VAL_27]]] : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>, !fir.slice<2>) -> !fir.array<10x?xi32> |
| 49 |
! CHECK: %[[VAL_29:.*]] = arith.constant 1 : index |
| 50 |
! CHECK: %[[VAL_30:.*]] = arith.constant 1 : i64 |
| 51 |
! CHECK: %[[VAL_31:.*]] = fir.convert %[[VAL_30]] : (i64) -> index |
| 52 |
! CHECK: %[[VAL_32:.*]] = arith.addi %[[VAL_29]], %[[VAL_1]] : index |
| 53 |
! CHECK: %[[VAL_33:.*]] = arith.subi %[[VAL_32]], %[[VAL_29]] : index |
| 54 |
! CHECK: %[[VAL_34:.*]] = arith.constant 3 : i64 |
| 55 |
! CHECK: %[[VAL_35:.*]] = fir.convert %[[VAL_34]] : (i64) -> index |
| 56 |
! CHECK: %[[VAL_36:.*]] = arith.constant 1 : i64 |
| 57 |
! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_36]] : (i64) -> index |
| 58 |
! CHECK: %[[VAL_38:.*]] = arith.constant 4 : i64 |
| 59 |
! CHECK: %[[VAL_39:.*]] = fir.convert %[[VAL_38]] : (i64) -> index |
| 60 |
! CHECK: %[[VAL_40:.*]] = fir.shape %[[VAL_1]], %[[VAL_2]] : (index, index) -> !fir.shape<2> |
| 61 |
! CHECK: %[[VAL_41:.*]] = fir.slice %[[VAL_29]], %[[VAL_33]], %[[VAL_31]], %[[VAL_35]], %[[VAL_39]], %[[VAL_37]] : (index, index, index, index, index, index) -> !fir.slice<2> |
| 62 |
! CHECK: %[[VAL_42:.*]] = fir.array_load %[[VAL_0]](%[[VAL_40]]) {{\[}}%[[VAL_41]]] : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>, !fir.slice<2>) -> !fir.array<10x?xi32> |
| 63 |
! CHECK: %[[VAL_43:.*]] = arith.constant 1 : index |
| 64 |
! CHECK: %[[VAL_44:.*]] = arith.constant 0 : index |
| 65 |
! CHECK: %[[VAL_45:.*]] = arith.subi %[[VAL_13]], %[[VAL_43]] : index |
| 66 |
! CHECK: %[[VAL_46:.*]] = arith.subi %[[VAL_25]], %[[VAL_43]] : index |
| 67 |
! CHECK: %[[VAL_47:.*]] = fir.do_loop %[[VAL_48:.*]] = %[[VAL_44]] to %[[VAL_46]] step %[[VAL_43]] unordered iter_args(%[[VAL_49:.*]] = %[[VAL_28]]) -> (!fir.array<10x?xi32>) { |
| 68 |
! CHECK: %[[VAL_50:.*]] = fir.do_loop %[[VAL_51:.*]] = %[[VAL_44]] to %[[VAL_45]] step %[[VAL_43]] unordered iter_args(%[[VAL_52:.*]] = %[[VAL_49]]) -> (!fir.array<10x?xi32>) { |
| 69 |
! CHECK: %[[VAL_53:.*]] = fir.array_fetch %[[VAL_42]], %[[VAL_51]], %[[VAL_48]] : (!fir.array<10x?xi32>, index, index) -> i32 |
| 70 |
! CHECK: %[[VAL_54:.*]] = fir.array_update %[[VAL_52]], %[[VAL_53]], %[[VAL_51]], %[[VAL_48]] : (!fir.array<10x?xi32>, i32, index, index) -> !fir.array<10x?xi32> |
| 71 |
! CHECK: fir.result %[[VAL_54]] : !fir.array<10x?xi32> |
| 72 |
! CHECK: } |
| 73 |
! CHECK: fir.result %[[VAL_55:.*]] : !fir.array<10x?xi32> |
| 74 |
! CHECK: } |
| 75 |
! CHECK: fir.array_merge_store %[[VAL_28]], %[[VAL_56:.*]] to %[[VAL_0]]{{\[}}%[[VAL_27]]] : !fir.array<10x?xi32>, !fir.array<10x?xi32>, !fir.ref<!fir.array<10x?xi32>>, !fir.slice<2> |
| 76 |
! CHECK: return |
| 77 |
! CHECK: } |
| 78 |
|
| 79 |
! CHECK-LABEL: func @_QPassumed_size_forall_test( |
| 80 |
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<10x?xi32>>{{.*}}) { |
| 81 |
! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {adapt.valuebyref, bindc_name = "i"} |
| 82 |
! CHECK: %[[VAL_2A:.*]] = fir.convert %c10{{.*}} : (i64) -> index |
| 83 |
! CHECK: %[[VAL_2B:.*]] = arith.cmpi sgt, %[[VAL_2A]], %c0{{.*}} : index |
| 84 |
! CHECK: %[[VAL_2:.*]] = arith.select %[[VAL_2B]], %[[VAL_2A]], %c0{{.*}} : index |
| 85 |
! CHECK: %[[VAL_3:.*]] = arith.constant -1 : index |
| 86 |
! CHECK: %[[VAL_4:.*]] = arith.constant 2 : i32 |
| 87 |
! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : (i32) -> index |
| 88 |
! CHECK: %[[VAL_6:.*]] = arith.constant 6 : i32 |
| 89 |
! CHECK: %[[VAL_7:.*]] = fir.convert %[[VAL_6]] : (i32) -> index |
| 90 |
! CHECK: %[[VAL_8:.*]] = arith.constant 1 : index |
| 91 |
! CHECK: %[[VAL_9:.*]] = fir.shape %[[VAL_2]], %[[VAL_3]] : (index, index) -> !fir.shape<2> |
| 92 |
! CHECK: %[[VAL_10:.*]] = fir.array_load %[[VAL_0]](%[[VAL_9]]) : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>) -> !fir.array<10x?xi32> |
| 93 |
! CHECK: %[[VAL_11:.*]] = fir.shape %[[VAL_2]], %[[VAL_3]] : (index, index) -> !fir.shape<2> |
| 94 |
! CHECK: %[[VAL_12:.*]] = fir.array_load %[[VAL_0]](%[[VAL_11]]) : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>) -> !fir.array<10x?xi32> |
| 95 |
! CHECK: %[[VAL_13:.*]] = fir.do_loop %[[VAL_14:.*]] = %[[VAL_5]] to %[[VAL_7]] step %[[VAL_8]] unordered iter_args(%[[VAL_15:.*]] = %[[VAL_10]]) -> (!fir.array<10x?xi32>) { |
| 96 |
! CHECK: %[[VAL_16:.*]] = fir.convert %[[VAL_14]] : (index) -> i32 |
| 97 |
! CHECK: fir.store %[[VAL_16]] to %[[VAL_1]] : !fir.ref<i32> |
| 98 |
! CHECK: %[[VAL_17:.*]] = arith.constant 1 : index |
| 99 |
! CHECK: %[[VAL_18:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32> |
| 100 |
! CHECK: %[[VAL_19:.*]] = fir.convert %[[VAL_18]] : (i32) -> i64 |
| 101 |
! CHECK: %[[VAL_20:.*]] = fir.convert %[[VAL_19]] : (i64) -> index |
| 102 |
! CHECK: %[[VAL_21:.*]] = arith.subi %[[VAL_20]], %[[VAL_17]] : index |
| 103 |
! CHECK: %[[VAL_22:.*]] = arith.constant 1 : i64 |
| 104 |
! CHECK: %[[VAL_23:.*]] = fir.convert %[[VAL_22]] : (i64) -> index |
| 105 |
! CHECK: %[[VAL_24:.*]] = arith.constant 1 : i64 |
| 106 |
! CHECK: %[[VAL_25:.*]] = fir.convert %[[VAL_24]] : (i64) -> index |
| 107 |
! CHECK: %[[VAL_26:.*]] = arith.constant 2 : i64 |
| 108 |
! CHECK: %[[VAL_27:.*]] = fir.convert %[[VAL_26]] : (i64) -> index |
| 109 |
! CHECK: %[[VAL_28:.*]] = arith.constant 0 : index |
| 110 |
! CHECK: %[[VAL_29:.*]] = arith.subi %[[VAL_27]], %[[VAL_23]] : index |
| 111 |
! CHECK: %[[VAL_30:.*]] = arith.addi %[[VAL_29]], %[[VAL_25]] : index |
| 112 |
! CHECK: %[[VAL_31:.*]] = arith.divsi %[[VAL_30]], %[[VAL_25]] : index |
| 113 |
! CHECK: %[[VAL_32:.*]] = arith.cmpi sgt, %[[VAL_31]], %[[VAL_28]] : index |
| 114 |
! CHECK: %[[VAL_33:.*]] = arith.select %[[VAL_32]], %[[VAL_31]], %[[VAL_28]] : index |
| 115 |
! CHECK: %[[VAL_34:.*]] = arith.constant 1 : index |
| 116 |
! CHECK: %[[VAL_35:.*]] = fir.load %[[VAL_1]] : !fir.ref<i32> |
| 117 |
! CHECK: %[[VAL_36:.*]] = fir.convert %[[VAL_35]] : (i32) -> i64 |
| 118 |
! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_36]] : (i64) -> index |
| 119 |
! CHECK: %[[VAL_38:.*]] = arith.subi %[[VAL_37]], %[[VAL_34]] : index |
| 120 |
! CHECK: %[[VAL_39:.*]] = arith.constant 3 : i64 |
| 121 |
! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (i64) -> index |
| 122 |
! CHECK: %[[VAL_41:.*]] = arith.constant 1 : i64 |
| 123 |
! CHECK: %[[VAL_42:.*]] = fir.convert %[[VAL_41]] : (i64) -> index |
| 124 |
! CHECK: %[[VAL_43:.*]] = arith.constant 1 : index |
| 125 |
! CHECK: %[[VAL_44:.*]] = arith.constant 0 : index |
| 126 |
! CHECK: %[[VAL_45:.*]] = arith.subi %[[VAL_33]], %[[VAL_43]] : index |
| 127 |
! CHECK: %[[VAL_46:.*]] = fir.do_loop %[[VAL_47:.*]] = %[[VAL_44]] to %[[VAL_45]] step %[[VAL_43]] unordered iter_args(%[[VAL_48:.*]] = %[[VAL_15]]) -> (!fir.array<10x?xi32>) { |
| 128 |
! CHECK: %[[VAL_49:.*]] = arith.subi %[[VAL_40]], %[[VAL_34]] : index |
| 129 |
! CHECK: %[[VAL_50:.*]] = arith.muli %[[VAL_47]], %[[VAL_42]] : index |
| 130 |
! CHECK: %[[VAL_51:.*]] = arith.addi %[[VAL_49]], %[[VAL_50]] : index |
| 131 |
! CHECK: %[[VAL_52:.*]] = fir.array_fetch %[[VAL_12]], %[[VAL_38]], %[[VAL_51]] : (!fir.array<10x?xi32>, index, index) -> i32 |
| 132 |
! CHECK: %[[VAL_53:.*]] = arith.subi %[[VAL_23]], %[[VAL_17]] : index |
| 133 |
! CHECK: %[[VAL_54:.*]] = arith.muli %[[VAL_47]], %[[VAL_25]] : index |
| 134 |
! CHECK: %[[VAL_55:.*]] = arith.addi %[[VAL_53]], %[[VAL_54]] : index |
| 135 |
! CHECK: %[[VAL_56:.*]] = fir.array_update %[[VAL_48]], %[[VAL_52]], %[[VAL_21]], %[[VAL_55]] : (!fir.array<10x?xi32>, i32, index, index) -> !fir.array<10x?xi32> |
| 136 |
! CHECK: fir.result %[[VAL_56]] : !fir.array<10x?xi32> |
| 137 |
! CHECK: } |
| 138 |
! CHECK: fir.result %[[VAL_57:.*]] : !fir.array<10x?xi32> |
| 139 |
! CHECK: } |
| 140 |
! CHECK: fir.array_merge_store %[[VAL_10]], %[[VAL_58:.*]] to %[[VAL_0]] : !fir.array<10x?xi32>, !fir.array<10x?xi32>, !fir.ref<!fir.array<10x?xi32>> |
| 141 |
! CHECK: return |
| 142 |
! CHECK: } |
| 143 |
|
| 144 |
! PostOpt-LABEL: func @_QPassumed_size_test( |
| 145 |
! PostOpt-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<10x?xi32>>{{.*}}) { |
| 146 |
! PostOpt-DAG: %[[VAL_1:.*]] = arith.constant 10 : index |
| 147 |
! PostOpt-DAG: %[[VAL_2:.*]] = arith.constant 1 : index |
| 148 |
! PostOpt-DAG: %[[VAL_3:.*]] = arith.constant 2 : index |
| 149 |
! PostOpt-DAG: %[[VAL_4:.*]] = arith.constant 0 : index |
| 150 |
! PostOpt-DAG: %[[VAL_5:.*]] = arith.constant 3 : index |
| 151 |
! PostOpt-DAG: %[[VAL_6:.*]] = arith.constant 4 : index |
| 152 |
! PostOpt-DAG: %[[VAL_7:.*]] = arith.constant -1 : index |
| 153 |
! PostOpt: %[[VAL_8:.*]] = fir.shape %[[VAL_1]], %[[VAL_7]] : (index, index) -> !fir.shape<2> |
| 154 |
! PostOpt: %[[VAL_9:.*]] = fir.slice %[[VAL_2]], %[[VAL_1]], %[[VAL_2]], %[[VAL_2]], %[[VAL_3]], %[[VAL_2]] : (index, index, index, index, index, index) -> !fir.slice<2> |
| 155 |
! PostOpt: %[[VAL_10:.*]] = fir.allocmem !fir.array<10x?xi32>, %[[VAL_3]] |
| 156 |
! PostOpt: br ^bb1(%[[VAL_4]], %[[VAL_3]] : index, index) |
| 157 |
! PostOpt: ^bb1(%[[VAL_11:.*]]: index, %[[VAL_12:.*]]: index): |
| 158 |
! PostOpt: %[[VAL_13:.*]] = arith.cmpi sgt, %[[VAL_12]], %[[VAL_4]] : index |
| 159 |
! PostOpt: cond_br %[[VAL_13]], ^bb2(%[[VAL_4]], %[[VAL_1]] : index, index), ^bb5 |
| 160 |
! PostOpt: ^bb2(%[[VAL_14:.*]]: index, %[[VAL_15:.*]]: index): |
| 161 |
! PostOpt: %[[VAL_16:.*]] = arith.cmpi sgt, %[[VAL_15]], %[[VAL_4]] : index |
| 162 |
! PostOpt: cond_br %[[VAL_16]], ^bb3, ^bb4 |
| 163 |
! PostOpt: ^bb3: |
| 164 |
! PostOpt: %[[VAL_17:.*]] = arith.addi %[[VAL_14]], %[[VAL_2]] : index |
| 165 |
! PostOpt: %[[VAL_18:.*]] = arith.addi %[[VAL_11]], %[[VAL_2]] : index |
| 166 |
! PostOpt: %[[VAL_19:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_8]]) {{\[}}%[[VAL_9]]] %[[VAL_17]], %[[VAL_18]] : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref<i32> |
| 167 |
! PostOpt: %[[VAL_20:.*]] = fir.array_coor %[[VAL_10]](%[[VAL_8]]) %[[VAL_17]], %[[VAL_18]] : (!fir.heap<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 168 |
! PostOpt: %[[VAL_21:.*]] = fir.load %[[VAL_19]] : !fir.ref<i32> |
| 169 |
! PostOpt: fir.store %[[VAL_21]] to %[[VAL_20]] : !fir.ref<i32> |
| 170 |
! PostOpt: %[[VAL_22:.*]] = arith.subi %[[VAL_15]], %[[VAL_2]] : index |
| 171 |
! PostOpt: br ^bb2(%[[VAL_17]], %[[VAL_22]] : index, index) |
| 172 |
! PostOpt: ^bb4: |
| 173 |
! PostOpt: %[[VAL_23:.*]] = arith.addi %[[VAL_11]], %[[VAL_2]] : index |
| 174 |
! PostOpt: %[[VAL_24:.*]] = arith.subi %[[VAL_12]], %[[VAL_2]] : index |
| 175 |
! PostOpt: br ^bb1(%[[VAL_23]], %[[VAL_24]] : index, index) |
| 176 |
! PostOpt: ^bb5: |
| 177 |
! PostOpt: %[[VAL_25:.*]] = fir.slice %[[VAL_2]], %[[VAL_1]], %[[VAL_2]], %[[VAL_5]], %[[VAL_6]], %[[VAL_2]] : (index, index, index, index, index, index) -> !fir.slice<2> |
| 178 |
! PostOpt: br ^bb6(%[[VAL_4]], %[[VAL_3]] : index, index) |
| 179 |
! PostOpt: ^bb6(%[[VAL_26:.*]]: index, %[[VAL_27:.*]]: index): |
| 180 |
! PostOpt: %[[VAL_28:.*]] = arith.cmpi sgt, %[[VAL_27]], %[[VAL_4]] : index |
| 181 |
! PostOpt: cond_br %[[VAL_28]], ^bb7(%[[VAL_4]], %[[VAL_1]] : index, index), ^bb10(%[[VAL_4]], %[[VAL_3]] : index, index) |
| 182 |
! PostOpt: ^bb7(%[[VAL_29:.*]]: index, %[[VAL_30:.*]]: index): |
| 183 |
! PostOpt: %[[VAL_31:.*]] = arith.cmpi sgt, %[[VAL_30]], %[[VAL_4]] : index |
| 184 |
! PostOpt: cond_br %[[VAL_31]], ^bb8, ^bb9 |
| 185 |
! PostOpt: ^bb8: |
| 186 |
! PostOpt: %[[VAL_32:.*]] = arith.addi %[[VAL_29]], %[[VAL_2]] : index |
| 187 |
! PostOpt: %[[VAL_33:.*]] = arith.addi %[[VAL_26]], %[[VAL_2]] : index |
| 188 |
! PostOpt: %[[VAL_34:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_8]]) {{\[}}%[[VAL_25]]] %[[VAL_32]], %[[VAL_33]] : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref<i32> |
| 189 |
! PostOpt: %[[VAL_35:.*]] = fir.load %[[VAL_34]] : !fir.ref<i32> |
| 190 |
! PostOpt: %[[VAL_36:.*]] = fir.array_coor %[[VAL_10]](%[[VAL_8]]) %[[VAL_32]], %[[VAL_33]] : (!fir.heap<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 191 |
! PostOpt: fir.store %[[VAL_35]] to %[[VAL_36]] : !fir.ref<i32> |
| 192 |
! PostOpt: %[[VAL_37:.*]] = arith.subi %[[VAL_30]], %[[VAL_2]] : index |
| 193 |
! PostOpt: br ^bb7(%[[VAL_32]], %[[VAL_37]] : index, index) |
| 194 |
! PostOpt: ^bb9: |
| 195 |
! PostOpt: %[[VAL_38:.*]] = arith.addi %[[VAL_26]], %[[VAL_2]] : index |
| 196 |
! PostOpt: %[[VAL_39:.*]] = arith.subi %[[VAL_27]], %[[VAL_2]] : index |
| 197 |
! PostOpt: br ^bb6(%[[VAL_38]], %[[VAL_39]] : index, index) |
| 198 |
! PostOpt: ^bb10(%[[VAL_40:.*]]: index, %[[VAL_41:.*]]: index): |
| 199 |
! PostOpt: %[[VAL_42:.*]] = arith.cmpi sgt, %[[VAL_41]], %[[VAL_4]] : index |
| 200 |
! PostOpt: cond_br %[[VAL_42]], ^bb11(%[[VAL_4]], %[[VAL_1]] : index, index), ^bb14 |
| 201 |
! PostOpt: ^bb11(%[[VAL_43:.*]]: index, %[[VAL_44:.*]]: index): |
| 202 |
! PostOpt: %[[VAL_45:.*]] = arith.cmpi sgt, %[[VAL_44]], %[[VAL_4]] : index |
| 203 |
! PostOpt: cond_br %[[VAL_45]], ^bb12, ^bb13 |
| 204 |
! PostOpt: ^bb12: |
| 205 |
! PostOpt: %[[VAL_46:.*]] = arith.addi %[[VAL_43]], %[[VAL_2]] : index |
| 206 |
! PostOpt: %[[VAL_47:.*]] = arith.addi %[[VAL_40]], %[[VAL_2]] : index |
| 207 |
! PostOpt: %[[VAL_48:.*]] = fir.array_coor %[[VAL_10]](%[[VAL_8]]) %[[VAL_46]], %[[VAL_47]] : (!fir.heap<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 208 |
! PostOpt: %[[VAL_49:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_8]]) {{\[}}%[[VAL_9]]] %[[VAL_46]], %[[VAL_47]] : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>, !fir.slice<2>, index, index) -> !fir.ref<i32> |
| 209 |
! PostOpt: %[[VAL_50:.*]] = fir.load %[[VAL_48]] : !fir.ref<i32> |
| 210 |
! PostOpt: fir.store %[[VAL_50]] to %[[VAL_49]] : !fir.ref<i32> |
| 211 |
! PostOpt: %[[VAL_51:.*]] = arith.subi %[[VAL_44]], %[[VAL_2]] : index |
| 212 |
! PostOpt: br ^bb11(%[[VAL_46]], %[[VAL_51]] : index, index) |
| 213 |
! PostOpt: ^bb13: |
| 214 |
! PostOpt: %[[VAL_52:.*]] = arith.addi %[[VAL_40]], %[[VAL_2]] : index |
| 215 |
! PostOpt: %[[VAL_53:.*]] = arith.subi %[[VAL_41]], %[[VAL_2]] : index |
| 216 |
! PostOpt: br ^bb10(%[[VAL_52]], %[[VAL_53]] : index, index) |
| 217 |
! PostOpt: ^bb14: |
| 218 |
! PostOpt: fir.freemem %[[VAL_10]] : !fir.heap<!fir.array<10x?xi32>> |
| 219 |
! PostOpt: return |
| 220 |
! PostOpt: } |
| 221 |
|
| 222 |
! PostOpt-LABEL: func @_QPassumed_size_forall_test( |
| 223 |
! PostOpt-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<10x?xi32>>{{.*}}) { |
| 224 |
! PostOpt-DAG: %[[VAL_1:.*]] = arith.constant 3 : index |
| 225 |
! PostOpt-DAG: %[[VAL_2:.*]] = arith.constant 10 : index |
| 226 |
! PostOpt-DAG: %[[VAL_3:.*]] = arith.constant 2 : index |
| 227 |
! PostOpt-DAG: %[[VAL_4:.*]] = arith.constant 1 : index |
| 228 |
! PostOpt-DAG: %[[VAL_5:.*]] = arith.constant 0 : index |
| 229 |
! PostOpt-DAG: %[[VAL_6:.*]] = arith.constant 5 : index |
| 230 |
! PostOpt-DAG: %[[VAL_8:.*]] = arith.constant -1 : index |
| 231 |
! PostOpt: %[[VAL_7:.*]] = fir.alloca i32 {adapt.valuebyref, bindc_name = "i"} |
| 232 |
! PostOpt: %[[VAL_9:.*]] = fir.shape %[[VAL_2]], %[[VAL_8]] : (index, index) -> !fir.shape<2> |
| 233 |
! PostOpt: %[[VAL_10:.*]] = fir.allocmem !fir.array<10x?xi32>, %[[VAL_4]] |
| 234 |
! PostOpt: br ^bb1(%[[VAL_5]], %[[VAL_4]] : index, index) |
| 235 |
! PostOpt: ^bb1(%[[VAL_11:.*]]: index, %[[VAL_12:.*]]: index): |
| 236 |
! PostOpt: %[[VAL_13:.*]] = arith.cmpi sgt, %[[VAL_12]], %[[VAL_5]] : index |
| 237 |
! PostOpt: cond_br %[[VAL_13]], ^bb2(%[[VAL_5]], %[[VAL_2]] : index, index), ^bb5 |
| 238 |
! PostOpt: ^bb2(%[[VAL_14:.*]]: index, %[[VAL_15:.*]]: index): |
| 239 |
! PostOpt: %[[VAL_16:.*]] = arith.cmpi sgt, %[[VAL_15]], %[[VAL_5]] : index |
| 240 |
! PostOpt: cond_br %[[VAL_16]], ^bb3, ^bb4 |
| 241 |
! PostOpt: ^bb3: |
| 242 |
! PostOpt: %[[VAL_17:.*]] = arith.addi %[[VAL_14]], %[[VAL_4]] : index |
| 243 |
! PostOpt: %[[VAL_18:.*]] = arith.addi %[[VAL_11]], %[[VAL_4]] : index |
| 244 |
! PostOpt: %[[VAL_19:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_9]]) %[[VAL_17]], %[[VAL_18]] : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 245 |
! PostOpt: %[[VAL_20:.*]] = fir.array_coor %[[VAL_10]](%[[VAL_9]]) %[[VAL_17]], %[[VAL_18]] : (!fir.heap<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 246 |
! PostOpt: %[[VAL_21:.*]] = fir.load %[[VAL_19]] : !fir.ref<i32> |
| 247 |
! PostOpt: fir.store %[[VAL_21]] to %[[VAL_20]] : !fir.ref<i32> |
| 248 |
! PostOpt: %[[VAL_22:.*]] = arith.subi %[[VAL_15]], %[[VAL_4]] : index |
| 249 |
! PostOpt: br ^bb2(%[[VAL_17]], %[[VAL_22]] : index, index) |
| 250 |
! PostOpt: ^bb4: |
| 251 |
! PostOpt: %[[VAL_23:.*]] = arith.addi %[[VAL_11]], %[[VAL_4]] : index |
| 252 |
! PostOpt: %[[VAL_24:.*]] = arith.subi %[[VAL_12]], %[[VAL_4]] : index |
| 253 |
! PostOpt: br ^bb1(%[[VAL_23]], %[[VAL_24]] : index, index) |
| 254 |
! PostOpt: ^bb5: |
| 255 |
! PostOpt: br ^bb6(%[[VAL_3]], %[[VAL_6]] : index, index) |
| 256 |
! PostOpt: ^bb6(%[[VAL_25:.*]]: index, %[[VAL_26:.*]]: index): |
| 257 |
! PostOpt: %[[VAL_27:.*]] = arith.cmpi sgt, %[[VAL_26]], %[[VAL_5]] : index |
| 258 |
! PostOpt: cond_br %[[VAL_27]], ^bb7, ^bb11(%[[VAL_5]], %[[VAL_4]] : index, index) |
| 259 |
! PostOpt: ^bb7: |
| 260 |
! PostOpt: %[[VAL_28:.*]] = fir.convert %[[VAL_25]] : (index) -> i32 |
| 261 |
! PostOpt: fir.store %[[VAL_28]] to %[[VAL_7]] : !fir.ref<i32> |
| 262 |
! PostOpt: %[[VAL_29:.*]] = fir.load %[[VAL_7]] : !fir.ref<i32> |
| 263 |
! PostOpt: %[[VAL_30:.*]] = fir.convert %[[VAL_29]] : (i32) -> index |
| 264 |
! PostOpt: br ^bb8(%[[VAL_5]], %[[VAL_3]] : index, index) |
| 265 |
! PostOpt: ^bb8(%[[VAL_31:.*]]: index, %[[VAL_32:.*]]: index): |
| 266 |
! PostOpt: %[[VAL_33:.*]] = arith.cmpi sgt, %[[VAL_32]], %[[VAL_5]] : index |
| 267 |
! PostOpt: cond_br %[[VAL_33]], ^bb9, ^bb10 |
| 268 |
! PostOpt: ^bb9: |
| 269 |
! PostOpt: %[[VAL_34:.*]] = arith.addi %[[VAL_31]], %[[VAL_1]] : index |
| 270 |
! PostOpt: %[[VAL_35:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_9]]) %[[VAL_30]], %[[VAL_34]] : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 271 |
! PostOpt: %[[VAL_36:.*]] = fir.load %[[VAL_35]] : !fir.ref<i32> |
| 272 |
! PostOpt: %[[VAL_37:.*]] = arith.addi %[[VAL_31]], %[[VAL_4]] : index |
| 273 |
! PostOpt: %[[VAL_38:.*]] = fir.array_coor %[[VAL_10]](%[[VAL_9]]) %[[VAL_30]], %[[VAL_37]] : (!fir.heap<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 274 |
! PostOpt: fir.store %[[VAL_36]] to %[[VAL_38]] : !fir.ref<i32> |
| 275 |
! PostOpt: %[[VAL_39:.*]] = arith.subi %[[VAL_32]], %[[VAL_4]] : index |
| 276 |
! PostOpt: br ^bb8(%[[VAL_37]], %[[VAL_39]] : index, index) |
| 277 |
! PostOpt: ^bb10: |
| 278 |
! PostOpt: %[[VAL_40:.*]] = arith.addi %[[VAL_25]], %[[VAL_4]] : index |
| 279 |
! PostOpt: %[[VAL_41:.*]] = arith.subi %[[VAL_26]], %[[VAL_4]] : index |
| 280 |
! PostOpt: br ^bb6(%[[VAL_40]], %[[VAL_41]] : index, index) |
| 281 |
! PostOpt: ^bb11(%[[VAL_42:.*]]: index, %[[VAL_43:.*]]: index): |
| 282 |
! PostOpt: %[[VAL_44:.*]] = arith.cmpi sgt, %[[VAL_43]], %[[VAL_5]] : index |
| 283 |
! PostOpt: cond_br %[[VAL_44]], ^bb12(%[[VAL_5]], %[[VAL_2]] : index, index), ^bb15 |
| 284 |
! PostOpt: ^bb12(%[[VAL_45:.*]]: index, %[[VAL_46:.*]]: index): |
| 285 |
! PostOpt: %[[VAL_47:.*]] = arith.cmpi sgt, %[[VAL_46]], %[[VAL_5]] : index |
| 286 |
! PostOpt: cond_br %[[VAL_47]], ^bb13, ^bb14 |
| 287 |
! PostOpt: ^bb13: |
| 288 |
! PostOpt: %[[VAL_48:.*]] = arith.addi %[[VAL_45]], %[[VAL_4]] : index |
| 289 |
! PostOpt: %[[VAL_49:.*]] = arith.addi %[[VAL_42]], %[[VAL_4]] : index |
| 290 |
! PostOpt: %[[VAL_50:.*]] = fir.array_coor %[[VAL_10]](%[[VAL_9]]) %[[VAL_48]], %[[VAL_49]] : (!fir.heap<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 291 |
! PostOpt: %[[VAL_51:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_9]]) %[[VAL_48]], %[[VAL_49]] : (!fir.ref<!fir.array<10x?xi32>>, !fir.shape<2>, index, index) -> !fir.ref<i32> |
| 292 |
! PostOpt: %[[VAL_52:.*]] = fir.load %[[VAL_50]] : !fir.ref<i32> |
| 293 |
! PostOpt: fir.store %[[VAL_52]] to %[[VAL_51]] : !fir.ref<i32> |
| 294 |
! PostOpt: %[[VAL_53:.*]] = arith.subi %[[VAL_46]], %[[VAL_4]] : index |
| 295 |
! PostOpt: br ^bb12(%[[VAL_48]], %[[VAL_53]] : index, index) |
| 296 |
! PostOpt: ^bb14: |
| 297 |
! PostOpt: %[[VAL_54:.*]] = arith.addi %[[VAL_42]], %[[VAL_4]] : index |
| 298 |
! PostOpt: %[[VAL_55:.*]] = arith.subi %[[VAL_43]], %[[VAL_4]] : index |
| 299 |
! PostOpt: br ^bb11(%[[VAL_54]], %[[VAL_55]] : index, index) |
| 300 |
! PostOpt: ^bb15: |
| 301 |
! PostOpt: fir.freemem %[[VAL_10]] : !fir.heap<!fir.array<10x?xi32>> |
| 302 |
! PostOpt: return |
| 303 |
! PostOpt: } |