[flang-commits] [flang] [flang][NFC] Converted five tests from old lowering to new lowering (part 15) (PR #179854)
via flang-commits
flang-commits at lists.llvm.org
Thu Feb 5 01:28:09 PST 2026
================
@@ -90,212 +90,181 @@ module caller
use callee
contains
-! CHECK-LABEL: func @_QMcallerPcst_array()
+! CHECK-LABEL: func.func @_QMcallerPcst_array()
subroutine cst_array()
- ! CHECK: %[[alloc:.*]] = fir.alloca !fir.array<20x30xf32> {{{.*}}bindc_name = ".result"}
- ! CHECK: %[[shape:.*]] = fir.shape %{{.*}}, {{.*}} : (index, index) -> !fir.shape<2>
- ! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_cst_array() {{.*}}: () -> !fir.array<20x30xf32>
- ! CHECK: fir.save_result %[[res]] to %[[alloc]](%[[shape]]) : !fir.array<20x30xf32>, !fir.ref<!fir.array<20x30xf32>>, !fir.shape<2>
+ ! CHECK: %[[VAL_14:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2>
+ ! CHECK: %[[VAL_15:.*]] = hlfir.eval_in_mem shape %[[VAL_14]] : (!fir.shape<2>) -> !hlfir.expr<20x30xf32> {
+ ! CHECK: ^bb0(%[[ARG:.*]]: !fir.ref<!fir.array<20x30xf32>>):
+ ! CHECK: %[[RES:.*]] = fir.call @_QMcalleePreturn_cst_array() {{.*}}: () -> !fir.array<20x30xf32>
+ ! CHECK: fir.save_result %[[RES]] to %[[ARG]](%[[VAL_14]]) : !fir.array<20x30xf32>, !fir.ref<!fir.array<20x30xf32>>, !fir.shape<2>
+ ! CHECK: }
+ ! CHECK: %[[VAL_16:.*]]:3 = hlfir.associate %[[VAL_15]](%[[VAL_14]])
print *, return_cst_array()
end subroutine
-! CHECK-LABEL: func @_QMcallerPcst_char_cst_array()
+! CHECK-LABEL: func.func @_QMcallerPcst_char_cst_array()
subroutine cst_char_cst_array()
- ! CHECK: %[[alloc:.*]] = fir.alloca !fir.array<20x30x!fir.char<1,10>> {{{.*}}bindc_name = ".result"}
- ! CHECK: %[[shape:.*]] = fir.shape %{{.*}}, {{.*}} : (index, index) -> !fir.shape<2>
- ! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_cst_char_cst_array() {{.*}}: () -> !fir.array<20x30x!fir.char<1,10>>
- ! CHECK: fir.save_result %[[res]] to %[[alloc]](%[[shape]]) typeparams %{{.*}} : !fir.array<20x30x!fir.char<1,10>>, !fir.ref<!fir.array<20x30x!fir.char<1,10>>>, !fir.shape<2>, index
+ ! CHECK: %[[VAL_17:.*]] = fir.shape %{{.*}}, %{{.*}} : (index, index) -> !fir.shape<2>
+ ! CHECK: %[[VAL_18:.*]] = hlfir.eval_in_mem shape %[[VAL_17]] typeparams %{{.*}} : (!fir.shape<2>, index) -> !hlfir.expr<20x30x!fir.char<1,10>> {
+ ! CHECK: ^bb0(%[[ARG:.*]]: !fir.ref<!fir.array<20x30x!fir.char<1,10>>>):
+ ! CHECK: %[[RES:.*]] = fir.call @_QMcalleePreturn_cst_char_cst_array() {{.*}}: () -> !fir.array<20x30x!fir.char<1,10>>
+ ! CHECK: fir.save_result %[[RES]] to %[[ARG]](%[[VAL_17]]) typeparams %{{.*}} : !fir.array<20x30x!fir.char<1,10>>, !fir.ref<!fir.array<20x30x!fir.char<1,10>>>, !fir.shape<2>, index
+ ! CHECK: }
+ ! CHECK: %[[VAL_19:.*]]:3 = hlfir.associate %[[VAL_18]](%[[VAL_17]]) typeparams %{{.*}}
print *, return_cst_char_cst_array()
end subroutine
-! CHECK-LABEL: func @_QMcallerPalloc()
+! CHECK-LABEL: func.func @_QMcallerPalloc()
subroutine alloc()
- ! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {{{.*}}bindc_name = ".result"}
- ! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_alloc() {{.*}}: () -> !fir.box<!fir.heap<!fir.array<?xf32>>>
- ! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.heap<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
+ ! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = ".result"}
+ ! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = ".tmp.func_result"}
+ ! CHECK: %[[VAL_6:.*]] = fir.call @_QMcalleePreturn_alloc() {{.*}}: () -> !fir.box<!fir.heap<!fir.array<?xf32>>>
+ ! CHECK: fir.save_result %[[VAL_6]] to %[[VAL_5]]#0 : !fir.box<!fir.heap<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
print *, return_alloc()
! CHECK: _FortranAioOutputDescriptor
- ! CHECK: %[[load:.*]] = fir.load %[[alloc]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
+ ! CHECK: %[[load:.*]] = fir.load %[[VAL_0]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
----------------
jeanPerier wrote:
This is failing, should be the declare result instead?
https://github.com/llvm/llvm-project/pull/179854
More information about the flang-commits
mailing list