[flang-commits] [flang] [flang] Converting old lowering tests to the new lowering (PR #172246)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Sun Dec 14 20:18:13 PST 2025


https://github.com/eugeneepshteyn updated https://github.com/llvm/llvm-project/pull/172246

>From 78802150b441afb0adfef5217ca05690939ef464 Mon Sep 17 00:00:00 2001
From: Eugene Epshteyn <eepshteyn at nvidia.com>
Date: Sun, 14 Dec 2025 23:00:21 -0500
Subject: [PATCH 1/3] [flang] Converting old lowering tests to the new lowering

---
 flang/test/Driver/compiler-options.f90    |   6 +-
 flang/test/Driver/frontend-forwarding.f90 |   2 -
 flang/test/Driver/optimization-remark.f90 |   2 +-
 flang/test/HLFIR/hlfir-flags.f90          |   7 +-
 flang/test/Lower/achar.f90                |  15 ++-
 flang/test/Lower/allocatable-callee.f90   |  12 +-
 flang/test/Lower/allocatable-caller.f90   |   2 +-
 flang/test/Lower/allocatable-return.f90   | 153 ++++++++++++++++++----
 8 files changed, 146 insertions(+), 53 deletions(-)

diff --git a/flang/test/Driver/compiler-options.f90 b/flang/test/Driver/compiler-options.f90
index cefa86836abd3..b9ecbbda227d1 100644
--- a/flang/test/Driver/compiler-options.f90
+++ b/flang/test/Driver/compiler-options.f90
@@ -1,11 +1,11 @@
-! RUN: %flang -S -emit-llvm -flang-deprecated-no-hlfir -o - %s | FileCheck %s
+! RUN: %flang -S -emit-llvm -o - %s | FileCheck %s
 ! Test communication of COMPILER_OPTIONS from flang to flang -fc1.
-! CHECK: [[OPTSVAR:@_QQclX[0-9a-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"{{.*}}flang{{(\.exe)?}} {{.*}}-S -emit-llvm -flang-deprecated-no-hlfir -o - {{.*}}compiler-options.f90"
+! CHECK: [[OPTSVAR:@_QQclX[0-9a-f]+]] = {{[a-z]+}} constant [[[OPTSLEN:[0-9]+]] x i8] c"{{.*}}flang{{(\.exe)?}} {{.*}}-S -emit-llvm -o - {{.*}}compiler-options.f90"
 program main
     use ISO_FORTRAN_ENV, only: compiler_options
     implicit none
     character (len = :), allocatable :: v
-! CHECK: call void @llvm.memmove.p0.p0.i64(ptr %{{[0-9]+}}, ptr [[OPTSVAR]], i64 [[OPTSLEN]], i1 false)
+! CHECK: store { ptr, i64, i32, i8, i8, i8, i8 } { ptr [[OPTSVAR]], i64 [[OPTSLEN]],
     v = compiler_options()
     print *, v
     deallocate(v)
diff --git a/flang/test/Driver/frontend-forwarding.f90 b/flang/test/Driver/frontend-forwarding.f90
index 952937168c95d..f47d8010bc233 100644
--- a/flang/test/Driver/frontend-forwarding.f90
+++ b/flang/test/Driver/frontend-forwarding.f90
@@ -19,7 +19,6 @@
 ! RUN:     -fpass-plugin=Bye%pluginext \
 ! RUN:     -fversion-loops-for-stride \
 ! RUN:     -flang-experimental-hlfir \
-! RUN:     -flang-deprecated-no-hlfir \
 ! RUN:     -fno-ppc-native-vector-element-order \
 ! RUN:     -fppc-native-vector-element-order \
 ! RUN:     -mllvm -print-before-all \
@@ -50,7 +49,6 @@
 ! CHECK: "-fpass-plugin=Bye
 ! CHECK: "-fversion-loops-for-stride"
 ! CHECK: "-flang-experimental-hlfir"
-! CHECK: "-flang-deprecated-no-hlfir"
 ! CHECK: "-fno-ppc-native-vector-element-order"
 ! CHECK: "-fppc-native-vector-element-order"
 ! CHECK: "-Rpass"
diff --git a/flang/test/Driver/optimization-remark.f90 b/flang/test/Driver/optimization-remark.f90
index 92b3bd8ba2081..76b794720e593 100644
--- a/flang/test/Driver/optimization-remark.f90
+++ b/flang/test/Driver/optimization-remark.f90
@@ -2,7 +2,7 @@
 ! and -Rpass-analysis)
 ! loop-delete isn't enabled at O0 so we use at least O1
 
-! DEFINE: %{output} = -emit-llvm -flang-deprecated-no-hlfir -o /dev/null 2>&1
+! DEFINE: %{output} = -emit-llvm -o /dev/null 2>&1
 
 ! Check fc1 can handle -Rpass
 ! RUN: %flang_fc1 %s -O1 -vectorize-loops -Rpass %{output} 2>&1 | FileCheck %s --check-prefix=REMARKS
diff --git a/flang/test/HLFIR/hlfir-flags.f90 b/flang/test/HLFIR/hlfir-flags.f90
index 0b1e80b1e3f63..168241661e0f5 100644
--- a/flang/test/HLFIR/hlfir-flags.f90
+++ b/flang/test/HLFIR/hlfir-flags.f90
@@ -5,10 +5,9 @@
 ! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
 ! RUN: bbc -emit-hlfir -hlfir -o - %s | FileCheck --check-prefix HLFIR --check-prefix ALL %s
 ! RUN: %flang_fc1 -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
-! RUN: %flang_fc1 -emit-fir -flang-deprecated-no-hlfir -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
 ! RUN: %flang_fc1 -emit-fir -flang-experimental-hlfir -o - %s | FileCheck %s --check-prefix FIR --check-prefix ALL
 ! RUN: bbc -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
-! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s --check-prefix NO-HLFIR --check-prefix ALL
+! RUN: bbc -emit-fir -o - %s | FileCheck --check-prefix FIR --check-prefix ALL %s
 
 ! | Action      | -flang-deprecated-no-hlfir  | Result                          |
 ! |             | / -hlfir=false?             |                                 |
@@ -27,18 +26,14 @@ subroutine test(a, res)
 ! ALL:             %[[RES:.*]]: !fir.ref<f32>
 
 ! HLFIR:         %[[A_VAR:.*]]:2 = hlfir.declare %[[A]]
-! fir.declare is only generated via the hlfir -> fir lowering
 ! FIR:           %[[A_VAR:.*]] = fir.declare %[[A]]
-! NO-HLFIR-NOT:  fir.declare
 
 ! HLFIR-DAG:     %[[RES_VAR:.*]]:2 = hlfir.declare %[[RES]]
 ! FIR:           %[[RES_VAR:.*]] = fir.declare %[[RES]]
-! NO-HLFIR-NOT:  fir.declare
 
 ! HLFIR-NEXT:    %[[SUM_RES:.*]] = hlfir.sum %[[A_VAR]]#0
 ! HLFIR-NEXT:    hlfir.assign %[[SUM_RES]] to %[[RES_VAR]]#0
 ! FIR-NOT:       hlfir.
-! NO-HLFIR-NOT:  hlfir.
 
 ! ALL:           return
 ! ALL-NEXT:  }
diff --git a/flang/test/Lower/achar.f90 b/flang/test/Lower/achar.f90
index 9b36d165e5133..f5b3168c424ca 100644
--- a/flang/test/Lower/achar.f90
+++ b/flang/test/Lower/achar.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc -emit-fir %s -o - | FileCheck %s
 
 ! Tests ACHAR lowering (converting an INTEGER to a CHARACTER (singleton, LEN=1)
 ! along with conversion of CHARACTER to another KIND.
@@ -13,12 +13,15 @@ end subroutine achar_test1
 
 ! CHECK-LABEL: func @_QPachar_test1(
 ! CHECK-SAME: %[[arg:.*]]: !fir.ref<i32> {fir.bindc_name = "a"}) {
-! CHECK: %[[VAL_0:.*]] = fir.alloca !fir.char<1>
-! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.char<2> {bindc_name = "ch", uniq_name = "_QFachar_test1Ech"}
-! CHECK: %[[VAL_2:.*]] = fir.load %[[arg]] : !fir.ref<i32>
+! CHECK: %[[VAL_TMP_ALLOCA:.*]] = fir.alloca !fir.char<2> {bindc_name = ".tmp"}
+! CHECK: %[[VAL_1_ALLOCA:.*]] = fir.alloca !fir.char<1>
+! CHECK: %[[VAL_DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK: %[[VAL_DECLARE:.*]] = fir.declare %[[arg]] dummy_scope %[[VAL_DUMMY_SCOPE]] arg 1 {fortran_attrs = #fir.var_attrs<intent_in>, uniq_name = "_QFachar_test1Ea"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32>
+! CHECK: %[[VAL_CH_ALLOCA:.*]] = fir.alloca !fir.char<2> {bindc_name = "ch", uniq_name = "_QFachar_test1Ech"}
+! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_DECLARE]] : !fir.ref<i32>
 ! CHECK: %[[VAL_5:.*]] = fir.undefined !fir.char<1>
 ! CHECK: %[[VAL_6:.*]] = fir.insert_value %[[VAL_5]], %{{.*}}, [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
-! CHECK: fir.store %[[VAL_6]] to %[[VAL_0]] : !fir.ref<!fir.char<1>>
+! CHECK: fir.store %[[VAL_6]] to %[[VAL_1_ALLOCA]] : !fir.ref<!fir.char<1>>
 ! CHECK: %[[VAL_7:.*]] = fir.alloca !fir.char<2,?>(%{{.*}} : index)
-! CHECK: fir.char_convert %[[VAL_0]] for %{{.*}} to %[[VAL_7]] : !fir.ref<!fir.char<1>>, index, !fir.ref<!fir.char<2,?>>
+! CHECK: fir.char_convert %[[VAL_1_ALLOCA]] for %{{.*}} to %[[VAL_7]] : !fir.ref<!fir.char<1>>, index, !fir.ref<!fir.char<2,?>>
 ! CHECK: fir.call @_QPachar_test1_foo(%{{.*}}) {{.*}}: (!fir.boxchar<2>) -> ()
diff --git a/flang/test/Lower/allocatable-callee.f90 b/flang/test/Lower/allocatable-callee.f90
index 23da3263748ad..5c5125e657e51 100644
--- a/flang/test/Lower/allocatable-callee.f90
+++ b/flang/test/Lower/allocatable-callee.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc -emit-fir %s -o - | FileCheck %s
 
 ! Test allocatable dummy argument on callee side
 
@@ -63,11 +63,13 @@ subroutine test_char_scalar_explicit_dynamic(c, n)
   ! CHECK:  %[[len:.*]] = arith.select %[[cmp]], %[[raw_len]], %[[c0_i32]] : i32
   n = n + 1
   ! CHECK: fir.store {{.*}} to %arg1 : !fir.ref<i32>
-  call foo1(c)
-  ! CHECK: %[[box:.*]] = fir.load %[[arg0]] : !fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>
+  call foo1(c(1))
+  ! CHECK: %[[box:.*]] = fir.load %[[arg0]] : !fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>>
   ! CHECK-DAG: %[[addr:.*]] = fir.box_addr %[[box]] : (!fir.box<!fir.heap<!fir.char<1,?>>>) -> !fir.heap<!fir.char<1,?>>
+  ! [...] address computation
+  ! CHECK: fir.coordinate_of
   ! CHECK-DAG: %[[len_cast:.*]] = fir.convert %[[len]] : (i32) -> index
-  ! CHECK: %[[boxchar:.*]] = fir.emboxchar %[[addr]], %[[len_cast]] : (!fir.heap<!fir.char<1,?>>, index) -> !fir.boxchar<1>
+  ! CHECK: %[[boxchar:.*]] = fir.emboxchar %{{.*}}, %[[len_cast]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
   ! CHECK: fir.call @_QPfoo1(%[[boxchar]]) {{.*}}: (!fir.boxchar<1>) -> ()
 end subroutine
 
@@ -174,4 +176,4 @@ subroutine test_char_assumed_optional(a)
     ! CHECK:   %[[argLenCast:.*]] = fir.convert %[[argLen]] : (index) -> i32
     ! CHECK:   fir.store %[[argLenCast]] to %{{.*}} : !fir.ref<i32>
   endif
-end subroutine
+end subroutine
\ No newline at end of file
diff --git a/flang/test/Lower/allocatable-caller.f90 b/flang/test/Lower/allocatable-caller.f90
index 0ea4cf342087e..2465470257826 100644
--- a/flang/test/Lower/allocatable-caller.f90
+++ b/flang/test/Lower/allocatable-caller.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc -emit-fir %s -o - | FileCheck %s
 
 ! Test passing allocatables on caller side
 
diff --git a/flang/test/Lower/allocatable-return.f90 b/flang/test/Lower/allocatable-return.f90
index 363d16237b9bf..6aa899c45e9aa 100644
--- a/flang/test/Lower/allocatable-return.f90
+++ b/flang/test/Lower/allocatable-return.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false -I nowhere %s -o - | FileCheck %s
+! RUN: bbc -emit-fir -I nowhere %s -o - | FileCheck %s
 
 ! Test allocatable return.
 ! Allocatable arrays must have default runtime lbounds after the return.
@@ -8,9 +8,17 @@ function test_alloc_return_scalar
   allocate(test_alloc_return_scalar)
 end function test_alloc_return_scalar
 ! CHECK-LABEL:   func.func @_QPtest_alloc_return_scalar() -> !fir.box<!fir.heap<f32>> {
-! CHECK:           %[[VAL_0:.*]] = fir.alloca !fir.box<!fir.heap<f32>> {bindc_name = "test_alloc_return_scalar", uniq_name = "_QFtest_alloc_return_scalarEtest_alloc_return_scalar"}
-! CHECK:           %[[VAL_5:.*]] = fir.load %[[VAL_0]] : !fir.ref<!fir.box<!fir.heap<f32>>>
-! CHECK:           return %[[VAL_5]] : !fir.box<!fir.heap<f32>>
+! CHECK:           %[[VAL_DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK:           %[[VAL_ALLOCA:.*]] = fir.alloca !fir.box<!fir.heap<f32>> {bindc_name = "test_alloc_return_scalar", uniq_name = "_QFtest_alloc_return_scalarEtest_alloc_return_scalar"}
+! CHECK:           %[[VAL_ZERO_BITS:.*]] = fir.zero_bits !fir.heap<f32>
+! CHECK:           %[[VAL_EMBOX:.*]] = fir.embox %[[VAL_ZERO_BITS]] : (!fir.heap<f32>) -> !fir.box<!fir.heap<f32>>
+! CHECK:           fir.store %[[VAL_EMBOX]] to %[[VAL_ALLOCA]] : !fir.ref<!fir.box<!fir.heap<f32>>>
+! CHECK:           %[[VAL_DECLARE:.*]] = fir.declare %[[VAL_ALLOCA]] {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_alloc_return_scalarEtest_alloc_return_scalar"} : (!fir.ref<!fir.box<!fir.heap<f32>>>) -> !fir.ref<!fir.box<!fir.heap<f32>>>
+! CHECK:           %[[VAL_ALLOCMEM:.*]] = fir.allocmem f32 {fir.must_be_heap = true, uniq_name = "_QFtest_alloc_return_scalarEtest_alloc_return_scalar.alloc"}
+! CHECK:           %[[VAL_EMBOX_ALLOC:.*]] = fir.embox %[[VAL_ALLOCMEM]] : (!fir.heap<f32>) -> !fir.box<!fir.heap<f32>>
+! CHECK:           fir.store %[[VAL_EMBOX_ALLOC]] to %[[VAL_DECLARE]] : !fir.ref<!fir.box<!fir.heap<f32>>>
+! CHECK:           %[[VAL_LOAD:.*]] = fir.load %[[VAL_DECLARE]] : !fir.ref<!fir.box<!fir.heap<f32>>>
+! CHECK:           return %[[VAL_LOAD]] : !fir.box<!fir.heap<f32>>
 ! CHECK:         }
 
 function test_alloc_return_array
@@ -18,12 +26,25 @@ function test_alloc_return_array
   allocate(test_alloc_return_array(7:8))
 end function test_alloc_return_array
 ! CHECK-LABEL:   func.func @_QPtest_alloc_return_array() -> !fir.box<!fir.heap<!fir.array<?xf32>>> {
-! CHECK:           %[[VAL_0:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "test_alloc_return_array", uniq_name = "_QFtest_alloc_return_arrayEtest_alloc_return_array"}
-! CHECK:           %[[VAL_18:.*]] = fir.load %[[VAL_0]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
-! CHECK:           %[[VAL_19:.*]] = arith.constant 1 : index
-! CHECK:           %[[VAL_20:.*]] = fir.shift %[[VAL_19]] : (index) -> !fir.shift<1>
-! CHECK:           %[[VAL_21:.*]] = fir.rebox %[[VAL_18]](%[[VAL_20]]) : (!fir.box<!fir.heap<!fir.array<?xf32>>>, !fir.shift<1>) -> !fir.box<!fir.heap<!fir.array<?xf32>>>
-! CHECK:           return %[[VAL_21]] : !fir.box<!fir.heap<!fir.array<?xf32>>>
+! CHECK:           %[[C2:.*]] = arith.constant 2 : index
+! CHECK:           %[[C7:.*]] = arith.constant 7 : index
+! CHECK:           %[[C1:.*]] = arith.constant 1 : index
+! CHECK:           %[[C0:.*]] = arith.constant 0 : index
+! CHECK:           %[[DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK:           %[[ALLOCA:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "test_alloc_return_array", uniq_name = "_QFtest_alloc_return_arrayEtest_alloc_return_array"}
+! CHECK:           %[[ZERO_BITS:.*]] = fir.zero_bits !fir.heap<!fir.array<?xf32>>
+! CHECK:           %[[SHAPE:.*]] = fir.shape %[[C0]] : (index) -> !fir.shape<1>
+! CHECK:           %[[EMBOX:.*]] = fir.embox %[[ZERO_BITS]](%[[SHAPE]]) : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.heap<!fir.array<?xf32>>>
+! CHECK:           fir.store %[[EMBOX]] to %[[ALLOCA]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
+! CHECK:           %[[DECLARE:.*]] = fir.declare %[[ALLOCA]] {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_alloc_return_arrayEtest_alloc_return_array"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
+! CHECK:           %[[ALLOCMEM:.*]] = fir.allocmem !fir.array<?xf32>, %[[C2]] {fir.must_be_heap = true, uniq_name = "_QFtest_alloc_return_arrayEtest_alloc_return_array.alloc"}
+! CHECK:           %[[SHAPE_SHIFT:.*]] = fir.shape_shift %[[C7]], %[[C2]] : (index, index) -> !fir.shapeshift<1>
+! CHECK:           %[[EMBOX2:.*]] = fir.embox %[[ALLOCMEM]](%[[SHAPE_SHIFT]]) : (!fir.heap<!fir.array<?xf32>>, !fir.shapeshift<1>) -> !fir.box<!fir.heap<!fir.array<?xf32>>>
+! CHECK:           fir.store %[[EMBOX2]] to %[[DECLARE]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
+! CHECK:           %[[LOAD:.*]] = fir.load %[[DECLARE]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
+! CHECK:           %[[SHIFT:.*]] = fir.shift %[[C1]] : (index) -> !fir.shift<1>
+! CHECK:           %[[REBOX:.*]] = fir.rebox %[[LOAD]](%[[SHIFT]]) : (!fir.box<!fir.heap<!fir.array<?xf32>>>, !fir.shift<1>) -> !fir.box<!fir.heap<!fir.array<?xf32>>>
+! CHECK:           return %[[REBOX]] : !fir.box<!fir.heap<!fir.array<?xf32>>>
 ! CHECK:         }
 
 function test_alloc_return_char_scalar
@@ -31,9 +52,18 @@ function test_alloc_return_char_scalar
   allocate(test_alloc_return_char_scalar)
 end function test_alloc_return_char_scalar
 ! CHECK-LABEL:   func.func @_QPtest_alloc_return_char_scalar() -> !fir.box<!fir.heap<!fir.char<1,3>>> {
-! CHECK:           %[[VAL_0:.*]] = fir.alloca !fir.box<!fir.heap<!fir.char<1,3>>> {bindc_name = "test_alloc_return_char_scalar", uniq_name = "_QFtest_alloc_return_char_scalarEtest_alloc_return_char_scalar"}
-! CHECK:           %[[VAL_5:.*]] = fir.load %[[VAL_0]] : !fir.ref<!fir.box<!fir.heap<!fir.char<1,3>>>>
-! CHECK:           return %[[VAL_5]] : !fir.box<!fir.heap<!fir.char<1,3>>>
+! CHECK:           %[[C3:.*]] = arith.constant 3 : index
+! CHECK:           %[[DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK:           %[[ALLOCA:.*]] = fir.alloca !fir.box<!fir.heap<!fir.char<1,3>>> {bindc_name = "test_alloc_return_char_scalar", uniq_name = "_QFtest_alloc_return_char_scalarEtest_alloc_return_char_scalar"}
+! CHECK:           %[[ZERO_BITS:.*]] = fir.zero_bits !fir.heap<!fir.char<1,3>>
+! CHECK:           %[[EMBOX:.*]] = fir.embox %[[ZERO_BITS]] : (!fir.heap<!fir.char<1,3>>) -> !fir.box<!fir.heap<!fir.char<1,3>>>
+! CHECK:           fir.store %[[EMBOX]] to %[[ALLOCA]] : !fir.ref<!fir.box<!fir.heap<!fir.char<1,3>>>>
+! CHECK:           %[[DECLARE:.*]] = fir.declare %[[ALLOCA]] typeparams %[[C3]] {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_alloc_return_char_scalarEtest_alloc_return_char_scalar"} : (!fir.ref<!fir.box<!fir.heap<!fir.char<1,3>>>>, index) -> !fir.ref<!fir.box<!fir.heap<!fir.char<1,3>>>>
+! CHECK:           %[[ALLOCMEM:.*]] = fir.allocmem !fir.char<1,3> {fir.must_be_heap = true, uniq_name = "_QFtest_alloc_return_char_scalarEtest_alloc_return_char_scalar.alloc"}
+! CHECK:           %[[EMBOX2:.*]] = fir.embox %[[ALLOCMEM]] : (!fir.heap<!fir.char<1,3>>) -> !fir.box<!fir.heap<!fir.char<1,3>>>
+! CHECK:           fir.store %[[EMBOX2]] to %[[DECLARE]] : !fir.ref<!fir.box<!fir.heap<!fir.char<1,3>>>>
+! CHECK:           %[[LOAD:.*]] = fir.load %[[DECLARE]] : !fir.ref<!fir.box<!fir.heap<!fir.char<1,3>>>>
+! CHECK:           return %[[LOAD]] : !fir.box<!fir.heap<!fir.char<1,3>>>
 ! CHECK:         }
 
 function test_alloc_return_char_array
@@ -41,12 +71,26 @@ function test_alloc_return_char_array
   allocate(test_alloc_return_char_array(7:8))
 end function test_alloc_return_char_array
 ! CHECK-LABEL:   func.func @_QPtest_alloc_return_char_array() -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>> {
-! CHECK:           %[[VAL_0:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>> {bindc_name = "test_alloc_return_char_array", uniq_name = "_QFtest_alloc_return_char_arrayEtest_alloc_return_char_array"}
-! CHECK:           %[[VAL_18:.*]] = fir.load %[[VAL_0]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>>
-! CHECK:           %[[VAL_19:.*]] = arith.constant 1 : index
-! CHECK:           %[[VAL_20:.*]] = fir.shift %[[VAL_19]] : (index) -> !fir.shift<1>
-! CHECK:           %[[VAL_21:.*]] = fir.rebox %[[VAL_18]](%[[VAL_20]]) : (!fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>, !fir.shift<1>) -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>
-! CHECK:           return %[[VAL_21]] : !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>
+! CHECK:           %[[C2:.*]] = arith.constant 2 : index
+! CHECK:           %[[C7:.*]] = arith.constant 7 : index
+! CHECK:           %[[C1:.*]] = arith.constant 1 : index
+! CHECK:           %[[C0:.*]] = arith.constant 0 : index
+! CHECK:           %[[C3:.*]] = arith.constant 3 : index
+! CHECK:           %[[DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK:           %[[ALLOCA:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>> {bindc_name = "test_alloc_return_char_array", uniq_name = "_QFtest_alloc_return_char_arrayEtest_alloc_return_char_array"}
+! CHECK:           %[[ZERO_BITS:.*]] = fir.zero_bits !fir.heap<!fir.array<?x!fir.char<1,3>>>
+! CHECK:           %[[SHAPE:.*]] = fir.shape %[[C0]] : (index) -> !fir.shape<1>
+! CHECK:           %[[EMBOX:.*]] = fir.embox %[[ZERO_BITS]](%[[SHAPE]]) : (!fir.heap<!fir.array<?x!fir.char<1,3>>>, !fir.shape<1>) -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>
+! CHECK:           fir.store %[[EMBOX]] to %[[ALLOCA]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>>
+! CHECK:           %[[DECLARE:.*]] = fir.declare %[[ALLOCA]] typeparams %[[C3]] {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_alloc_return_char_arrayEtest_alloc_return_char_array"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>>, index) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>>
+! CHECK:           %[[ALLOCMEM:.*]] = fir.allocmem !fir.array<?x!fir.char<1,3>>, %[[C2]] {fir.must_be_heap = true, uniq_name = "_QFtest_alloc_return_char_arrayEtest_alloc_return_char_array.alloc"}
+! CHECK:           %[[SHAPE_SHIFT:.*]] = fir.shape_shift %[[C7]], %[[C2]] : (index, index) -> !fir.shapeshift<1>
+! CHECK:           %[[EMBOX2:.*]] = fir.embox %[[ALLOCMEM]](%[[SHAPE_SHIFT]]) : (!fir.heap<!fir.array<?x!fir.char<1,3>>>, !fir.shapeshift<1>) -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>
+! CHECK:           fir.store %[[EMBOX2]] to %[[DECLARE]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>>
+! CHECK:           %[[LOAD:.*]] = fir.load %[[DECLARE]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>>
+! CHECK:           %[[SHIFT:.*]] = fir.shift %[[C1]] : (index) -> !fir.shift<1>
+! CHECK:           %[[REBOX:.*]] = fir.rebox %[[LOAD]](%[[SHIFT]]) : (!fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>, !fir.shift<1>) -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>
+! CHECK:           return %[[REBOX]] : !fir.box<!fir.heap<!fir.array<?x!fir.char<1,3>>>>
 ! CHECK:         }
 
 function test_alloc_return_poly_scalar
@@ -56,9 +100,31 @@ function test_alloc_return_poly_scalar
   allocate(t :: test_alloc_return_poly_scalar)
 end function test_alloc_return_poly_scalar
 ! CHECK-LABEL:   func.func @_QPtest_alloc_return_poly_scalar() -> !fir.class<!fir.heap<none>> {
-! CHECK:           %[[VAL_0:.*]] = fir.alloca !fir.class<!fir.heap<none>> {bindc_name = "test_alloc_return_poly_scalar", uniq_name = "_QFtest_alloc_return_poly_scalarEtest_alloc_return_poly_scalar"}
-! CHECK:           %[[VAL_16:.*]] = fir.load %[[VAL_0]] : !fir.ref<!fir.class<!fir.heap<none>>>
-! CHECK:           return %[[VAL_16]] : !fir.class<!fir.heap<none>>
+! CHECK:           %[[C_NEG1_I64:.*]] = arith.constant -1 : i64
+! CHECK:           %[[C0_I32:.*]] = arith.constant 0 : i32
+! CHECK:           %[[C100_I32:.*]] = arith.constant 100 : i32
+! CHECK:           %[[FALSE:.*]] = arith.constant false
+! CHECK:           %[[C1:.*]] = arith.constant 1 : index
+! CHECK:           %[[DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK:           %[[ADDRESS_OF_N_T:.*]] = fir.address_of(@_QFtest_alloc_return_poly_scalarE.n.t) : !fir.ref<!fir.char<1>>
+! CHECK:           %[[DECLARE_N_T:.*]] = fir.declare %[[ADDRESS_OF_N_T]] typeparams %[[C1]] {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtest_alloc_return_poly_scalarE.n.t"} : (!fir.ref<!fir.char<1>>, index) -> !fir.ref<!fir.char<1>>
+! CHECK:           %[[ALLOCA:.*]] = fir.alloca !fir.class<!fir.heap<none>> {bindc_name = "test_alloc_return_poly_scalar", uniq_name = "_QFtest_alloc_return_poly_scalarEtest_alloc_return_poly_scalar"}
+! CHECK:           %[[ZERO_BITS:.*]] = fir.zero_bits !fir.heap<none>
+! CHECK:           %[[EMBOX:.*]] = fir.embox %[[ZERO_BITS]] : (!fir.heap<none>) -> !fir.class<!fir.heap<none>>
+! CHECK:           fir.store %[[EMBOX]] to %[[ALLOCA]] : !fir.ref<!fir.class<!fir.heap<none>>>
+! CHECK:           %[[DECLARE:.*]] = fir.declare %[[ALLOCA]] {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_alloc_return_poly_scalarEtest_alloc_return_poly_scalar"} : (!fir.ref<!fir.class<!fir.heap<none>>>) -> !fir.ref<!fir.class<!fir.heap<none>>>
+! CHECK:           %[[ABSENT:.*]] = fir.absent !fir.box<none>
+! CHECK:           %[[ADDRESS_OF_DT_T:.*]] = fir.address_of(@_QFtest_alloc_return_poly_scalarE.dt.t) : !fir.ref<!fir.type<_QM__fortran_type_infoTderivedtype{binding:!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QM__fortran_type_infoTbinding{proc:!fir.type<_QM__fortran_builtinsT__builtin_c_funptr{__address:i64}>,name:!fir.box<!fir.ptr<!fir.char<1,?>>>}>>>>,name:!fir.box<!fir.ptr<!fir.char<1,?>>>,sizeinbytes:i64,uninstantiated:!fir.box<!fir.ptr<!fir.type<_QM__fortran_type_infoTderivedtype>>>,kindparameter:!fir.box<!fir.ptr<!fir.array<?xi64>>>,lenparameterkind:!fir.box<!fir.ptr<!fir.array<?xi8>>>,component:!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QM__fortran_type_infoTcomponent{name:!fir.box<!fir.ptr<!fir.char<1,?>>>,genre:i8,category:i8,kind:i8,rank:i8,__padding0:!fir.array<4xi8>,offset:i64,characterlen:!fir.type<_QM__fortran_type_infoTvalue{genre:i8,__padding0:!fir.array<7xi8>,value:i64}>,derived:!fir.box<!fir.ptr<!fir.type<_QM__fortran_type_infoTderivedtype>>>,lenvalue:!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QM__fortran_type_infoTvalue{genre:i8,__padding0:!fir.array<7xi8>,value:i64}>>>>,bounds:!fir.box<!fir.ptr<!fir.array<?x?x!fir.type<_QM__fortran_type_infoTvalue{genre:i8,__padding0:!fir.array<7xi8>,value:i64}>>>>,initialization:!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>}>>>>,procptr:!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QM__fortran_type_infoTprocptrcomponent{name:!fir.box<!fir.ptr<!fir.char<1,?>>>,offset:i64,initialization:!fir.type<_QM__fortran_builtinsT__builtin_c_funptr{__address:i64}>}>>>>,special:!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QM__fortran_type_infoTspecialbinding{which:i8,isargdescriptorset:i8,istypebound:i8,specialcaseflag:i8,__padding0:!fir.array<4xi8>,proc:!fir.type<_QM__fortran_builtinsT__builtin_c_funptr{__address:i64}>}>>>>,specialbitset:i32,hasparent:i8,noinitializationneeded:i8,nodestructionneeded:i8,nofinalizationneeded:i8,nodefinedassignment:i8,__padding0:!fir.array<3xi8>}>>
+! CHECK:           %[[TYPE_DESC:.*]] = fir.type_desc !fir.type<_QFtest_alloc_return_poly_scalarTt>
+! CHECK:           %[[CONVERT_DECLARE:.*]] = fir.convert %[[DECLARE]] : (!fir.ref<!fir.class<!fir.heap<none>>>) -> !fir.ref<!fir.box<none>>
+! CHECK:           %[[CONVERT_TYPE_DESC:.*]] = fir.convert %[[TYPE_DESC]] : (!fir.tdesc<!fir.type<_QFtest_alloc_return_poly_scalarTt>>) -> !fir.ref<none>
+! CHECK:           fir.call @_FortranAAllocatableInitDerivedForAllocate(%[[CONVERT_DECLARE]], %[[CONVERT_TYPE_DESC]], %[[C0_I32]], %[[C0_I32]]) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.ref<none>, i32, i32) -> ()
+! CHECK:           %[[CONVERT_C_NEG1_I64:.*]] = fir.convert %[[C_NEG1_I64]] : (i64) -> !fir.ref<i64>
+! CHECK:           %[[ADDRESS_OF_STRING:.*]] = fir.address_of(@_QQclXcda6f2a3409966289c088d50bcd8bfed) : !fir.ref<!fir.char<1,88>>
+! CHECK:           %[[CONVERT_STRING:.*]] = fir.convert %[[ADDRESS_OF_STRING]] : (!fir.ref<!fir.char<1,88>>) -> !fir.ref<i8>
+! CHECK:           %[[CALL_ALLOCATE:.*]] = fir.call @_FortranAAllocatableAllocate(%[[CONVERT_DECLARE]], %[[CONVERT_C_NEG1_I64]], %[[FALSE]], %[[ABSENT]], %[[CONVERT_STRING]], %[[C100_I32]]) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.ref<i64>, i1, !fir.box<none>, !fir.ref<i8>, i32) -> i32
+! CHECK:           %[[LOAD:.*]] = fir.load %[[DECLARE]] : !fir.ref<!fir.class<!fir.heap<none>>>
+! CHECK:           return %[[LOAD]] : !fir.class<!fir.heap<none>>>
 ! CHECK:         }
 
 function test_alloc_return_poly_array
@@ -68,10 +134,39 @@ function test_alloc_return_poly_array
   allocate(t :: test_alloc_return_poly_array(7:8))
 end function test_alloc_return_poly_array
 ! CHECK-LABEL:   func.func @_QPtest_alloc_return_poly_array() -> !fir.class<!fir.heap<!fir.array<?xnone>>> {
-! CHECK:           %[[VAL_0:.*]] = fir.alloca !fir.class<!fir.heap<!fir.array<?xnone>>> {bindc_name = "test_alloc_return_poly_array", uniq_name = "_QFtest_alloc_return_poly_arrayEtest_alloc_return_poly_array"}
-! CHECK:           %[[VAL_25:.*]] = fir.load %[[VAL_0]] : !fir.ref<!fir.class<!fir.heap<!fir.array<?xnone>>>>
-! CHECK:           %[[VAL_26:.*]] = arith.constant 1 : index
-! CHECK:           %[[VAL_27:.*]] = fir.shift %[[VAL_26]] : (index) -> !fir.shift<1>
-! CHECK:           %[[VAL_28:.*]] = fir.rebox %[[VAL_25]](%[[VAL_27]]) : (!fir.class<!fir.heap<!fir.array<?xnone>>>, !fir.shift<1>) -> !fir.class<!fir.heap<!fir.array<?xnone>>>
-! CHECK:           return %[[VAL_28]] : !fir.class<!fir.heap<!fir.array<?xnone>>>
-! CHECK:         }
+! CHECK:           %[[C_NEG1_I64:.*]] = arith.constant -1 : i64
+! CHECK:           %[[C8_I32:.*]] = arith.constant 8 : i32
+! CHECK:           %[[C7_I32:.*]] = arith.constant 7 : i32
+! CHECK:           %[[C0_I32:.*]] = arith.constant 0 : i32
+! CHECK:           %[[C1_I32:.*]] = arith.constant 1 : i32
+! CHECK:           %[[C134_I32:.*]] = arith.constant 134 : i32
+! CHECK:           %[[FALSE:.*]] = arith.constant false
+! CHECK:           %[[C0:.*]] = arith.constant 0 : index
+! CHECK:           %[[C1:.*]] = arith.constant 1 : index
+! CHECK:           %[[DUMMY_SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK:           %[[ADDRESS_OF_N_T:.*]] = fir.address_of(@_QFtest_alloc_return_poly_arrayE.n.t) : !fir.ref<!fir.char<1>>
+! CHECK:           %[[DECLARE_N_T:.*]] = fir.declare %[[ADDRESS_OF_N_T]] typeparams %[[C1]] {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtest_alloc_return_poly_arrayE.n.t"} : (!fir.ref<!fir.char<1>>, index) -> !fir.ref<!fir.char<1>>
+! CHECK:           %[[ALLOCA:.*]] = fir.alloca !fir.class<!fir.heap<!fir.array<?xnone>>> {bindc_name = "test_alloc_return_poly_array", uniq_name = "_QFtest_alloc_return_poly_arrayEtest_alloc_return_poly_array"}
+! CHECK:           %[[ZERO_BITS:.*]] = fir.zero_bits !fir.heap<!fir.array<?xnone>>
+! CHECK:           %[[SHAPE:.*]] = fir.shape %[[C0]] : (index) -> !fir.shape<1>
+! CHECK:           %[[EMBOX:.*]] = fir.embox %[[ZERO_BITS]](%[[SHAPE]]) : (!fir.heap<!fir.array<?xnone>>, !fir.shape<1>) -> !fir.class<!fir.heap<!fir.array<?xnone>>>
+! CHECK:           fir.store %[[EMBOX]] to %[[ALLOCA]] : !fir.ref<!fir.class<!fir.heap<!fir.array<?xnone>>>>
+! CHECK:           %[[DECLARE:.*]] = fir.declare %[[ALLOCA]] {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest_alloc_return_poly_arrayEtest_alloc_return_poly_array"} : (!fir.ref<!fir.class<!fir.heap<!fir.array<?xnone>>>>) -> !fir.ref<!fir.class<!fir.heap<!fir.array<?xnone>>>>
+! CHECK:           %[[ADDRESS_OF_DT_T:.*]] = fir.address_of(@_QFtest_alloc_return_poly_arrayE.dt.t) : !fir.ref<!fir.type<_QM__fortran_type_infoTderivedtype{{.*}}>>
+! CHECK:           %[[ABSENT:.*]] = fir.absent !fir.box<none>
+! CHECK:           %[[TYPE_DESC:.*]] = fir.type_desc !fir.type<_QFtest_alloc_return_poly_arrayTt>
+! CHECK:           %[[CONVERT_DECLARE:.*]] = fir.convert %[[DECLARE]] : (!fir.ref<!fir.class<!fir.heap<!fir.array<?xnone>>>>) -> !fir.ref<!fir.box<none>>
+! CHECK:           %[[CONVERT_TYPE_DESC:.*]] = fir.convert %[[TYPE_DESC]] : (!fir.tdesc<!fir.type<_QFtest_alloc_return_poly_arrayTt>>) -> !fir.ref<none>
+! CHECK:           fir.call @_FortranAAllocatableInitDerivedForAllocate(%[[CONVERT_DECLARE]], %[[CONVERT_TYPE_DESC]], %[[C1_I32]], %[[C0_I32]]) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.ref<none>, i32, i32) -> ()
+! CHECK:           %[[CONVERT_C7_I32:.*]] = fir.convert %[[C7_I32]] : (i32) -> i64
+! CHECK:           %[[CONVERT_C8_I32:.*]] = fir.convert %[[C8_I32]] : (i32) -> i64
+! CHECK:           fir.call @_FortranAAllocatableSetBounds(%[[CONVERT_DECLARE]], %[[C0_I32]], %[[CONVERT_C7_I32]], %[[CONVERT_C8_I32]]) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> ()
+! CHECK:           %[[CONVERT_C_NEG1_I64:.*]] = fir.convert %[[C_NEG1_I64]] : (i64) -> !fir.ref<i64>
+! CHECK:           %[[ADDRESS_OF_STRING:.*]] = fir.address_of(@_QQclXcda6f2a3409966289c088d50bcd8bfed) : !fir.ref<!fir.char<1,88>>
+! CHECK:           %[[CONVERT_STRING:.*]] = fir.convert %[[ADDRESS_OF_STRING]] : (!fir.ref<!fir.char<1,88>>) -> !fir.ref<i8>
+! CHECK:           %[[CALL_ALLOCATE:.*]] = fir.call @_FortranAAllocatableAllocate(%[[CONVERT_DECLARE]], %[[CONVERT_C_NEG1_I64]], %[[FALSE]], %[[ABSENT]], %[[CONVERT_STRING]], %[[C134_I32]]) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.ref<i64>, i1, !fir.box<none>, !fir.ref<i8>, i32) -> i32
+! CHECK:           %[[LOAD:.*]] = fir.load %[[DECLARE]] : !fir.ref<!fir.class<!fir.heap<!fir.array<?xnone>>>>
+! CHECK:           %[[SHIFT:.*]] = fir.shift %[[C1]] : (index) -> !fir.shift<1>
+! CHECK:           %[[REBOX:.*]] = fir.rebox %[[LOAD]](%[[SHIFT]]) : (!fir.class<!fir.heap<!fir.array<?xnone>>>, !fir.shift<1>) -> !fir.class<!fir.heap<!fir.array<?xnone>>>
+! CHECK:           return %[[REBOX]] : !fir.class<!fir.heap<!fir.array<?xnone>>>
+! CHECK:         }
\ No newline at end of file

>From 3644175dd4a30f86d25dfcd06f4f972722626920 Mon Sep 17 00:00:00 2001
From: Eugene Epshteyn <eepshteyn at nvidia.com>
Date: Sun, 14 Dec 2025 23:13:02 -0500
Subject: [PATCH 2/3] Undid changes to test/Lower/allocatable-callee.f90

---
 flang/test/Lower/allocatable-callee.f90 | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/flang/test/Lower/allocatable-callee.f90 b/flang/test/Lower/allocatable-callee.f90
index 5c5125e657e51..23da3263748ad 100644
--- a/flang/test/Lower/allocatable-callee.f90
+++ b/flang/test/Lower/allocatable-callee.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -emit-fir %s -o - | FileCheck %s
+! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
 
 ! Test allocatable dummy argument on callee side
 
@@ -63,13 +63,11 @@ subroutine test_char_scalar_explicit_dynamic(c, n)
   ! CHECK:  %[[len:.*]] = arith.select %[[cmp]], %[[raw_len]], %[[c0_i32]] : i32
   n = n + 1
   ! CHECK: fir.store {{.*}} to %arg1 : !fir.ref<i32>
-  call foo1(c(1))
-  ! CHECK: %[[box:.*]] = fir.load %[[arg0]] : !fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>>
+  call foo1(c)
+  ! CHECK: %[[box:.*]] = fir.load %[[arg0]] : !fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>
   ! CHECK-DAG: %[[addr:.*]] = fir.box_addr %[[box]] : (!fir.box<!fir.heap<!fir.char<1,?>>>) -> !fir.heap<!fir.char<1,?>>
-  ! [...] address computation
-  ! CHECK: fir.coordinate_of
   ! CHECK-DAG: %[[len_cast:.*]] = fir.convert %[[len]] : (i32) -> index
-  ! CHECK: %[[boxchar:.*]] = fir.emboxchar %{{.*}}, %[[len_cast]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
+  ! CHECK: %[[boxchar:.*]] = fir.emboxchar %[[addr]], %[[len_cast]] : (!fir.heap<!fir.char<1,?>>, index) -> !fir.boxchar<1>
   ! CHECK: fir.call @_QPfoo1(%[[boxchar]]) {{.*}}: (!fir.boxchar<1>) -> ()
 end subroutine
 
@@ -176,4 +174,4 @@ subroutine test_char_assumed_optional(a)
     ! CHECK:   %[[argLenCast:.*]] = fir.convert %[[argLen]] : (index) -> i32
     ! CHECK:   fir.store %[[argLenCast]] to %{{.*}} : !fir.ref<i32>
   endif
-end subroutine
\ No newline at end of file
+end subroutine

>From d7b1e6527cc592e2109d08551e05901b909794a9 Mon Sep 17 00:00:00 2001
From: Eugene Epshteyn <eepshteyn at nvidia.com>
Date: Sun, 14 Dec 2025 23:18:02 -0500
Subject: [PATCH 3/3] End of file

---
 flang/test/Lower/allocatable-return.f90 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flang/test/Lower/allocatable-return.f90 b/flang/test/Lower/allocatable-return.f90
index 6aa899c45e9aa..2e2ef28a7902b 100644
--- a/flang/test/Lower/allocatable-return.f90
+++ b/flang/test/Lower/allocatable-return.f90
@@ -169,4 +169,5 @@ end function test_alloc_return_poly_array
 ! CHECK:           %[[SHIFT:.*]] = fir.shift %[[C1]] : (index) -> !fir.shift<1>
 ! CHECK:           %[[REBOX:.*]] = fir.rebox %[[LOAD]](%[[SHIFT]]) : (!fir.class<!fir.heap<!fir.array<?xnone>>>, !fir.shift<1>) -> !fir.class<!fir.heap<!fir.array<?xnone>>>
 ! CHECK:           return %[[REBOX]] : !fir.class<!fir.heap<!fir.array<?xnone>>>
-! CHECK:         }
\ No newline at end of file
+! CHECK:         }
+



More information about the flang-commits mailing list