[flang-commits] [flang] 9663ef3 - [flang][NFC] Converted five tests from old lowering to new lowering (part 45) (#192265)
via flang-commits
flang-commits at lists.llvm.org
Wed Apr 15 10:56:32 PDT 2026
Author: Eugene Epshteyn
Date: 2026-04-15T13:56:27-04:00
New Revision: 9663ef399f327106f6c7307d08490c958db5c091
URL: https://github.com/llvm/llvm-project/commit/9663ef399f327106f6c7307d08490c958db5c091
DIFF: https://github.com/llvm/llvm-project/commit/9663ef399f327106f6c7307d08490c958db5c091.diff
LOG: [flang][NFC] Converted five tests from old lowering to new lowering (part 45) (#192265)
Tests converted from test/Lower: io-statement-2.f90, io-statement-3.f90,
io-statement-big-unit-checks.f90, io-statement-open-options.f90,
io-write.f90
Added:
Modified:
flang/test/Lower/io-statement-2.f90
flang/test/Lower/io-statement-3.f90
flang/test/Lower/io-statement-big-unit-checks.f90
flang/test/Lower/io-statement-open-options.f90
flang/test/Lower/io-write.f90
Removed:
################################################################################
diff --git a/flang/test/Lower/io-statement-2.f90 b/flang/test/Lower/io-statement-2.f90
index dcf7387f8a22d..47b5fa07674bc 100644
--- a/flang/test/Lower/io-statement-2.f90
+++ b/flang/test/Lower/io-statement-2.f90
@@ -1,4 +1,4 @@
-! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck %s
! UNSUPPORTED: system-windows
character*10 :: exx
@@ -161,7 +161,7 @@ subroutine loopnest
subroutine impliedformat
! CHECK: BeginExternalListInput
! CHECK: InputReal32
- ! CHECK: EndIoStatement(%3) {{.*}}: (!fir.ref<i8>) -> i32
+ ! CHECK: EndIoStatement(
read*, x
! CHECK: BeginExternalListOutput
! CHECK: OutputReal32
diff --git a/flang/test/Lower/io-statement-3.f90 b/flang/test/Lower/io-statement-3.f90
index 174161706a1e8..7df91b27a997e 100644
--- a/flang/test/Lower/io-statement-3.f90
+++ b/flang/test/Lower/io-statement-3.f90
@@ -1,5 +1,5 @@
! Test lowering of IO read SIZE control-spec (12.6.2.15)
-! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -o - %s | FileCheck %s
! CHECK-LABEL: func @_QPtest_read_size(
! CHECK-SAME: %[[sizeVar:[^:]+]]: !fir.ref<i32>{{[^,]*}},
@@ -19,12 +19,12 @@ subroutine test_read_size(size, c1, c2, unit, stat)
! CHECK: }
! CHECK: %[[sizeValue:.*]] = fir.call @_FortranAioGetSize(%[[cookie]]) {{.*}}: (!fir.ref<i8>) -> i64
! CHECK: %[[sizeCast:.*]] = fir.convert %[[sizeValue]] : (i64) -> i32
- ! CHECK: fir.store %[[sizeCast]] to %[[sizeVar]] : !fir.ref<i32>
+ ! CHECK: fir.store %[[sizeCast]] to %{{.*}} : !fir.ref<i32>
! CHECK: fir.call @_FortranAioEndIoStatement(%[[cookie]]) {{.*}}: (!fir.ref<i8>) -> i32
READ(unit, '(A)', ADVANCE='NO', SIZE=size, IOSTAT=stat) c1, c2
end subroutine
- ! CHECK: %[[unit:.*]] = fir.alloca i32 {bindc_name = "unit", uniq_name = "_QFEunit"}
+ ! CHECK: fir.alloca i32 {bindc_name = "unit", uniq_name = "_QFEunit"}
integer :: unit
character(7) :: c1
character(4) :: c2
@@ -36,7 +36,7 @@ subroutine test_read_size(size, c1, c2, unit, stat)
! CHECK: fir.call @_FortranAioSetForm(%[[cookie]], %{{.*}}, %{{.*}}) {{.*}}: (!fir.ref<i8>, !fir.ref<i8>, i64) -> i1
! CHECK: fir.call @_FortranAioSetStatus(%[[cookie]], %{{.*}}, %{{.*}}) {{.*}}: (!fir.ref<i8>, !fir.ref<i8>, i64) -> i1
! CHECK: %[[kind:.*]] = arith.constant 4 : i32
- ! CHECK: fir.call @_FortranAioGetNewUnit(%[[cookie]], %[[unit]], %[[kind]]) {{.*}}: (!fir.ref<i8>, !fir.ref<i32>, i32) -> i1
+ ! CHECK: fir.call @_FortranAioGetNewUnit(%[[cookie]], %{{.*}}, %[[kind]]) {{.*}}: (!fir.ref<i8>, !fir.ref<i32>, i32) -> i1
! CHECK: fir.call @_FortranAioEndIoStatement(%[[cookie]]) {{.*}}: (!fir.ref<i8>) -> i32
OPEN(NEWUNIT=unit,ACCESS='SEQUENTIAL',ACTION='READWRITE',&
FORM='FORMATTED',STATUS='SCRATCH')
diff --git a/flang/test/Lower/io-statement-big-unit-checks.f90 b/flang/test/Lower/io-statement-big-unit-checks.f90
index 2be658c1f76d2..f78bf22598a7f 100644
--- a/flang/test/Lower/io-statement-big-unit-checks.f90
+++ b/flang/test/Lower/io-statement-big-unit-checks.f90
@@ -2,7 +2,7 @@
! unit number that may turn out at runtime to be too large to fit in a default
! integer. Unit numbers must fit on default integers. This file tests that the
! related generated runtime checks and error recovery code.
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
! -----------------------------------------------------------------------------
@@ -41,7 +41,7 @@ subroutine write_4_recovery(n4, ios)
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i64>
subroutine open_8(n)
integer(8) :: n
-! CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_1:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_2:.*]] = arith.constant false
! CHECK: %[[VAL_3:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i64
@@ -57,7 +57,7 @@ subroutine open_8(n)
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i64>
subroutine close_8(n)
integer(8) :: n
-! CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_1:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_2:.*]] = arith.constant false
! CHECK: %[[VAL_3:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i64
@@ -71,7 +71,7 @@ subroutine close_8(n)
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i64>
subroutine rewind_8(n)
integer(8) :: n
-! CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_1:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_2:.*]] = arith.constant false
! CHECK: %[[VAL_3:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i64
@@ -86,7 +86,7 @@ subroutine rewind_8(n)
subroutine backspace_8(n)
integer(8) :: n
backspace(n)
-! CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_1:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_2:.*]] = arith.constant false
! CHECK: %[[VAL_3:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i64
@@ -100,7 +100,7 @@ subroutine backspace_8(n)
subroutine inquire_8(n, fm)
integer(8) :: n
character(*), fm
-! CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_1:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_2:.*]] = arith.constant false
! CHECK: %[[VAL_3:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i64
@@ -114,7 +114,7 @@ subroutine inquire_8(n, fm)
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i64>
subroutine write_8(n)
integer(8) :: n
-! CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_1:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_2:.*]] = arith.constant false
! CHECK: %[[VAL_3:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i64
@@ -129,7 +129,7 @@ subroutine write_8(n)
subroutine read_8(n, var)
integer(8) :: n
integer(4) :: var
-! CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_1:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_2:.*]] = arith.constant false
! CHECK: %[[VAL_3:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i64
@@ -143,7 +143,7 @@ subroutine read_8(n, var)
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i128>
subroutine open_16(n)
integer(16) :: n
-! CHECK: %[[VAL_1:.*]] = fir.load %[[VAL_0]] : !fir.ref<i128>
+! CHECK: %[[VAL_1:.*]] = fir.load %{{.*}} : !fir.ref<i128>
! CHECK: %[[VAL_2:.*]] = arith.constant false
! CHECK: %[[VAL_3:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_4:.*]] = arith.constant 0 : i64
@@ -162,7 +162,7 @@ subroutine open_16(n)
subroutine open_8_error_recovery_1(n, ios)
integer(8) :: n
integer(4) :: ios
-! CHECK: %[[VAL_2:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_2:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_3:.*]] = arith.constant true
! CHECK: %[[VAL_4:.*]] = fir.zero_bits !fir.ref<i8>
! CHECK: %[[VAL_5:.*]] = arith.constant 0 : i64
@@ -183,7 +183,7 @@ subroutine open_8_error_recovery_1(n, ios)
! CHECK: } else {
! CHECK: fir.result %[[VAL_9]] : i32
! CHECK: }
-! CHECK: fir.store %[[VAL_25:.*]] to %[[VAL_1]] : !fir.ref<i32>
+! CHECK: fir.store %[[VAL_12]] to %{{.*}} : !fir.ref<i32>
open(n, iostat=ios)
end subroutine
@@ -194,10 +194,10 @@ subroutine open_8_error_recovery_2(n, msg)
integer(8) :: n
character(*) :: msg
! CHECK: %[[VAL_2:.*]]:2 = fir.unboxchar %[[VAL_1]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
-! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_0]] : !fir.ref<i64>
+! CHECK: %[[VAL_3:.*]] = fir.load %{{.*}} : !fir.ref<i64>
! CHECK: %[[VAL_4:.*]] = arith.constant true
-! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_2]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
-! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_2]]#1 : (index) -> i64
+! CHECK: %[[VAL_5:.*]] = fir.convert %{{.*}} : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
+! CHECK: %[[VAL_6:.*]] = fir.convert %{{.*}} : (index) -> i64
! CHECK: %[[VAL_10:.*]] = fir.call @_FortranAioCheckUnitNumberInRange64(%[[VAL_3]], %[[VAL_4]], %[[VAL_5]], %[[VAL_6]], %{{.*}}, %{{.*}}) {{.*}}: (i64, i1, !fir.ref<i8>, i64, !fir.ref<i8>, i32) -> i32
! CHECK: %[[VAL_11:.*]] = arith.constant 0 : i32
! CHECK: %[[VAL_12:.*]] = arith.cmpi eq, %[[VAL_10]], %[[VAL_11]] : i32
@@ -210,21 +210,21 @@ subroutine open_8_error_recovery_2(n, msg)
! CHECK: %[[VAL_22:.*]] = arith.constant false
! CHECK: %[[VAL_23:.*]] = arith.constant true
! CHECK: fir.call @_FortranAioEnableHandlers(%[[VAL_18]], %[[VAL_19]], %[[VAL_20]], %[[VAL_21]], %[[VAL_22]], %[[VAL_23]]) {{.*}}: (!fir.ref<i8>, i1, i1, i1, i1, i1) -> ()
-! CHECK: %[[VAL_25:.*]] = fir.convert %[[VAL_2]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
-! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_2]]#1 : (index) -> i64
+! CHECK: %[[VAL_25:.*]] = fir.convert %{{.*}} : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
+! CHECK: %[[VAL_26:.*]] = fir.convert %{{.*}} : (index) -> i64
! CHECK: fir.call @_FortranAioGetIoMsg(%[[VAL_18]], %[[VAL_25]], %[[VAL_26]]) {{.*}}: (!fir.ref<i8>, !fir.ref<i8>, i64) -> ()
! CHECK: %[[VAL_28:.*]] = fir.call @_FortranAioEndIoStatement(%[[VAL_18]]) {{.*}}: (!fir.ref<i8>) -> i32
! CHECK: fir.result %[[VAL_28]] : i32
! CHECK: } else {
! CHECK: fir.result %[[VAL_10]] : i32
! CHECK: }
-! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_30:.*]] : (i32) -> index
+! CHECK: %[[VAL_29:.*]] = fir.convert %[[VAL_13]] : (i32) -> index
! CHECK: fir.select %[[VAL_29]] : index [0, ^bb1, unit, ^bb2]
! CHECK: ^bb1:
-! CHECK: br ^bb3
+! CHECK: cf.br ^bb3
! CHECK: ^bb2:
! CHECK: fir.call @_QPi_failed() {{.*}}: () -> ()
-! CHECK: br ^bb3
+! CHECK: cf.br ^bb3
! CHECK: ^bb3:
! CHECK: return
open(n, err=30, iomsg=msg)
@@ -263,53 +263,31 @@ function make_temp5()
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<!fir.array<2xi64>> {fir.bindc_name = "n"},
! CHECK-SAME: %[[VAL_1:.*]]: !fir.boxchar<1> {fir.bindc_name = "msg"},
! CHECK-SAME: %[[VAL_2:.*]]: !fir.ref<!fir.array<2xi32>> {fir.bindc_name = "ios"}) {
-! CHECK: %[[VAL_10:.*]] = fir.call @_QPmake_temp2() {{.*}}: () -> !fir.box<!fir.heap<i32>>
-! CHECK: fir.save_result %[[VAL_10]] to %[[VAL_8:.*]] : !fir.box<!fir.heap<i32>>, !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_15:.*]] = fir.call @_QPmake_temp3() {{.*}}: () -> !fir.box<!fir.heap<i32>>
-! CHECK: fir.save_result %[[VAL_15]] to %[[VAL_7:.*]] : !fir.box<!fir.heap<i32>>, !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: fir.load %[[VAL_7]]
-! CHECK: %[[VAL_32:.*]] = fir.load %[[VAL_7]] : !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_33:.*]] = fir.box_addr %[[VAL_32]] : (!fir.box<!fir.heap<i32>>) -> !fir.heap<i32>
-! CHECK: fir.freemem %[[VAL_33]] : !fir.heap<i32>
-! CHECK: %[[VAL_37:.*]] = fir.load %[[VAL_8]] : !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_38:.*]] = fir.box_addr %[[VAL_37]] : (!fir.box<!fir.heap<i32>>) -> !fir.heap<i32>
-! CHECK: fir.freemem %[[VAL_38]] : !fir.heap<i32>
-! CHECK: %[[VAL_42:.*]] = fir.call @_QPmake_temp0() {{.*}}: () -> !fir.box<!fir.heap<i32>>
-! CHECK: fir.save_result %[[VAL_42]] to %[[VAL_6:.*]] : !fir.box<!fir.heap<i32>>, !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_57:.*]] = fir.call @_FortranAioCheckUnitNumberInRange64(
-! CHECK: %[[VAL_58:.*]] = arith.constant 0 : i32
-! CHECK: %[[VAL_59:.*]] = arith.cmpi eq, %[[VAL_57]], %[[VAL_58]] : i32
-! CHECK: %[[VAL_60:.*]] = fir.if %[[VAL_59]] -> (i32) {
+! CHECK: fir.call @_QPmake_temp2()
+! CHECK: fir.call @_QPmake_temp3()
+! CHECK: fir.freemem
+! CHECK: fir.freemem
+! CHECK: fir.call @_QPmake_temp0()
+! CHECK: fir.call @_FortranAioCheckUnitNumberInRange64(
+! CHECK: %[[VAL_57:.*]] = arith.constant 0 : i32
+! CHECK: %[[VAL_58:.*]] = arith.cmpi eq, %{{.*}}, %[[VAL_57]] : i32
+! CHECK: %[[VAL_60:.*]] = fir.if %[[VAL_58]] -> (i32) {
! CHECK: fir.call @_FortranAioBeginUnformattedOutput(
! CHECK: fir.call @_FortranAioEnableHandlers(
-! CHECK: %[[VAL_72:.*]] = fir.call @_QPmake_temp4() {{.*}}: () -> !fir.box<!fir.heap<i32>>
-! CHECK: fir.save_result %[[VAL_72]] to %[[VAL_5:.*]] : !fir.box<!fir.heap<i32>>, !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_77:.*]] = fir.call @_FortranAioOutputDescriptor(
-! CHECK: %[[VAL_77_1:.*]] = fir.load %[[VAL_5]] : !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_77_2:.*]] = fir.box_addr %[[VAL_77_1]] : (!fir.box<!fir.heap<i32>>) -> !fir.heap<i32>
-! CHECK: fir.freemem %[[VAL_77_2]] : !fir.heap<i32>
-! CHECK: fir.if %[[VAL_77]] {
-! CHECK: %[[VAL_78:.*]] = fir.call @_QPmake_temp5() {{.*}}: () -> !fir.box<!fir.heap<i32>>
-! CHECK: fir.save_result %[[VAL_78]] to %[[VAL_4:.*]] : !fir.box<!fir.heap<i32>>, !fir.ref<!fir.box<!fir.heap<i32>>>
+! CHECK: fir.call @_QPmake_temp4()
+! CHECK: fir.call @_FortranAioOutputDescriptor(
+! CHECK: fir.freemem
+! CHECK: fir.if %{{.*}} {
+! CHECK: fir.call @_QPmake_temp5()
! CHECK: fir.call @_FortranAioOutputDescriptor(
-! CHECK: %[[VAL_84:.*]] = fir.load %[[VAL_4]] : !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_85:.*]] = fir.box_addr %[[VAL_84]] : (!fir.box<!fir.heap<i32>>) -> !fir.heap<i32>
-! CHECK: fir.freemem %[[VAL_85]] : !fir.heap<i32>
+! CHECK: fir.freemem
! CHECK: }
! CHECK-NOT: fir.call @_QPmake_temp3
! CHECK: fir.call @_FortranAioGetIoMsg(
! CHECK: %[[VAL_97:.*]] = fir.call @_FortranAioEndIoStatement(
! CHECK: fir.result %[[VAL_97]] : i32
! CHECK: } else {
-! CHECK: fir.result %[[VAL_57]] : i32
+! CHECK: fir.result %{{.*}} : i32
! CHECK: }
-! CHECK: %[[VAL_98:.*]] = fir.call @_QPmake_temp1() {{.*}}: () -> !fir.box<!fir.heap<i32>>
-! CHECK: fir.save_result %[[VAL_98]] to %[[VAL_3:.*]] : !fir.box<!fir.heap<i32>>, !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: fir.load %[[VAL_3]]
-! CHECK: %[[VAL_107:.*]] = fir.load %[[VAL_3]] : !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_108:.*]] = fir.box_addr %[[VAL_107]] : (!fir.box<!fir.heap<i32>>) -> !fir.heap<i32>
-! CHECK: fir.freemem %[[VAL_108]] : !fir.heap<i32>
-! CHECK: %[[VAL_112:.*]] = fir.load %[[VAL_6]] : !fir.ref<!fir.box<!fir.heap<i32>>>
-! CHECK: %[[VAL_113:.*]] = fir.box_addr %[[VAL_112]] : (!fir.box<!fir.heap<i32>>) -> !fir.heap<i32>
-! CHECK: fir.freemem %[[VAL_113]] : !fir.heap<i32>
+! CHECK: fir.call @_QPmake_temp1()
end
diff --git a/flang/test/Lower/io-statement-open-options.f90 b/flang/test/Lower/io-statement-open-options.f90
index 9f469b2892a62..ef64ecd7991c3 100755
--- a/flang/test/Lower/io-statement-open-options.f90
+++ b/flang/test/Lower/io-statement-open-options.f90
@@ -1,13 +1,14 @@
! Test lowering of OPEN statment options
-! RUN: bbc %s -emit-fir -hlfir=false -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
! CHECK-LABEL: func.func @_QPtest_convert_specifier(
subroutine test_convert_specifier(unit)
integer :: unit
! CHECK: %[[cookie:.*]] = fir.call @_FortranAioBeginOpenUnit(%{{.*}}, %{{.*}}, %{{.*}}) {{.*}}: (i32, !fir.ref<i8>, i32) -> !fir.ref<i8>
- ! CHECK: %[[be_str:.*]] = fir.address_of(@[[be_str_name:.*]]) : !fir.ref<!fir.char<1,10>>
+ ! CHECK: %[[be_str_addr:.*]] = fir.address_of(@[[be_str_name:.*]]) : !fir.ref<!fir.char<1,10>>
! CHECK: %[[len:.*]] = arith.constant 10 : index
- ! CHECK: %[[be_str_conv:.*]] = fir.convert %[[be_str]] : (!fir.ref<!fir.char<1,10>>) -> !fir.ref<i8>
+ ! CHECK: %[[be_str:.*]]:2 = hlfir.declare %[[be_str_addr]] typeparams %[[len]]
+ ! CHECK: %[[be_str_conv:.*]] = fir.convert %[[be_str]]#0 : (!fir.ref<!fir.char<1,10>>) -> !fir.ref<i8>
! CHECK: %[[len_conv:.*]] = fir.convert %[[len]] : (index) -> i64
! CHECK: %{{.*}} = fir.call @_FortranAioSetConvert(%[[cookie]], %[[be_str_conv]], %[[len_conv]]) {{.*}}: (!fir.ref<i8>, !fir.ref<i8>, i64) -> i1
! CHECK: %{{.*}} = fir.call @_FortranAioEndIoStatement(%[[cookie]]) {{.*}}: (!fir.ref<i8>) -> i32
diff --git a/flang/test/Lower/io-write.f90 b/flang/test/Lower/io-write.f90
index 3159dcf771bb7..f625132e03102 100644
--- a/flang/test/Lower/io-write.f90
+++ b/flang/test/Lower/io-write.f90
@@ -1,37 +1,22 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir %s -o - | FileCheck %s
! Test that IO item calls stackrestore in the right place
! CHECK-LABEL: func.func @_QQmain() {
character(3) string
write(string,getstring(6))
-! CHECK: %[[Val_0:.*]] = fir.alloca i32 {adapt.valuebyref}
! CHECK: %[[Const_3:.*]] = arith.constant 3 : index
-! CHECK: %[[Val_1:.*]] = fir.alloca !fir.char<1,3> {bindc_name = "string", uniq_name = "_QFEstring"}
-! CHECK: %[[Val_2:.*]] = fir.convert %[[Val_1]] : (!fir.ref<!fir.char<1,3>>) -> !fir.ref<i8>
+! CHECK: %[[Val_1:.*]] = fir.alloca !fir.char<1,3> {bindc_name = "string"
+! CHECK: %[[string:.*]]:2 = hlfir.declare %[[Val_1]] typeparams %[[Const_3]]
+! CHECK: %[[Val_2:.*]] = fir.convert %[[string]]#0 : (!fir.ref<!fir.char<1,3>>) -> !fir.ref<i8>
! CHECK: %[[Val_3:.*]] = fir.convert %[[Const_3]] : (index) -> i64
-! CHECK: %[[Const_6:.*]] = arith.constant 6 : i32
-! CHECK: fir.store %[[Const_6]] to %[[Val_0]] : !fir.ref<i32>
-! CHECK: %[[Val_4:.*]] = fir.load %[[Val_0]] : !fir.ref<i32>
-! CHECK: %[[Val_5:.*]] = fir.convert %[[Val_4]] : (i32) -> i64
-! CHECK: %[[Val_6:.*]] = fir.convert %[[Val_5]] : (i64) -> index
-! CHECK: %[[Const_0:.*]] = arith.constant 0 : index
-! CHECK: %[[Val_7:.*]] = arith.cmpi sgt, %[[Val_6]], %[[Const_0]] : index
-! CHECK: %[[Val_8:.*]] = arith.select %[[Val_7]], %[[Val_6]], %[[Const_0]] : index
+! CHECK: %[[n_assoc:.*]]:3 = hlfir.associate %{{.*}} {adapt.valuebyref}
+! CHECK: %[[Val_8:.*]] = arith.select %{{.*}}, %{{.*}}, %{{.*}} : index
! CHECK: %[[Val_9:.*]] = llvm.intr.stacksave : !llvm.ptr
! CHECK: %[[Val_10:.*]] = fir.alloca !fir.char<1,?>(%[[Val_8]] : index) {bindc_name = ".result"}
-! CHECK: %[[Val_11:.*]] = fir.call @_QFPgetstring(%[[Val_10]], %[[Val_8]], %[[Val_0]]) {{.*}}: (!fir.ref<!fir.char<1,?>>, index, !fir.ref<i32>) -> !fir.boxchar<1>
-! CHECK: %[[Val_12:.*]] = fir.convert %[[Val_10]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
-! CHECK: %[[Val_13:.*]] = fir.convert %[[Val_8]] : (index) -> i64
-! CHECK: %[[Val_14:.*]] = fir.zero_bits !fir.box<none>
-! CHECK: %[[Const_0_i64:.*]] = arith.constant 0 : i64
-! CHECK: %[[Val_15:.*]] = fir.convert %[[Const_0_i64]] : (i64) -> !fir.ref<!fir.llvm_ptr<i8>>
-! CHECK: %[[Const_0_i64_0:.*]] = arith.constant 0 : i64
-! CHECK: %[[Val_16:.*]] = fir.address_of(@_QQclX{{.*}}) : !fir.ref<!fir.char<1,{{.*}}>>
-! CHECK: %[[Val_17:.*]] = fir.convert %[[Val_16]] : (!fir.ref<!fir.char<1,{{.*}}>>) -> !fir.ref<i8>
-! CHECK: %[[Val_18:.*]] = fir.call @_FortranAioBeginInternalFormattedOutput(%[[Val_2]], %[[Val_3]], %[[Val_12]], %[[Val_13]],
-! %[[Val_14]], %[[Val_15]], %[[Const_0_i64_0]], %17, %{{.*}}) : (!fir.ref<i8>, i64, !fir.ref<i8>, i64, !fir.box<none>, !fir.ref<!fir.llvm_ptr<i8>>, i64, !fir.ref<i8>, i32) -> !fir.ref<i8>
-! CHECK: %[[Val_19:.*]] = fir.call @_FortranAioEndIoStatement(%18) {{.*}}: (!fir.ref<i8>) -> i32
+! CHECK: fir.call @_QFPgetstring(%[[Val_10]], %[[Val_8]], %[[n_assoc]]#0)
+! CHECK: %[[Val_18:.*]] = fir.call @_FortranAioBeginInternalFormattedOutput(%[[Val_2]], %[[Val_3]],
+! CHECK: %[[Val_19:.*]] = fir.call @_FortranAioEndIoStatement(%[[Val_18]])
! CHECK: llvm.intr.stackrestore %[[Val_9]] : !llvm.ptr
if (string/="hi") stop 'FAIL'
contains
More information about the flang-commits
mailing list