[flang-commits] [flang] [flang][NFC] Converted five tests from old lowering to new lowering (part 8) (PR #175881)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Tue Jan 13 20:00:35 PST 2026
https://github.com/eugeneepshteyn created https://github.com/llvm/llvm-project/pull/175881
Tests converted from test/Lower: block.f90, call-copy-in-out.f90, call-implicit.f90, call.f90, character-compare.f90
>From a4b4a834384c0aba31498f83c53de634196afb45 Mon Sep 17 00:00:00 2001
From: Eugene Epshteyn <eepshteyn at nvidia.com>
Date: Tue, 13 Jan 2026 22:58:11 -0500
Subject: [PATCH] [flang][NFC] Converted five tests from old lowering to new
lowering (part 8)
Tests converted from test/Lower: block.f90, call-copy-in-out.f90, call-implicit.f90,
call.f90, character-compare.f90
---
flang/test/Lower/block.f90 | 63 +++----
flang/test/Lower/call-copy-in-out.f90 | 244 ++++++-------------------
flang/test/Lower/call-implicit.f90 | 14 +-
flang/test/Lower/call.f90 | 23 ++-
flang/test/Lower/character-compare.f90 | 5 +-
5 files changed, 110 insertions(+), 239 deletions(-)
diff --git a/flang/test/Lower/block.f90 b/flang/test/Lower/block.f90
index d2bc90ef6c671..c36f98a4ca313 100644
--- a/flang/test/Lower/block.f90
+++ b/flang/test/Lower/block.f90
@@ -1,66 +1,66 @@
-! RUN: bbc -emit-fir -hlfir=false -o - %s | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
! CHECK-LABEL: func @_QQmain
program bb ! block stack management and exits
- ! CHECK: %[[V_0:[0-9]+]] = fir.alloca i32 {adapt.valuebyref}
! CHECK: %[[V_1:[0-9]+]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFEi"}
+ ! CHECK: %[[V_I:[0-9]+]]:2 = hlfir.declare %[[V_1]] {uniq_name = "_QFEi"}
integer :: i, j
- ! CHECK: fir.store %c0{{.*}} to %[[V_1]] : !fir.ref<i32>
+ ! CHECK: hlfir.assign %c0{{.*}} to %[[V_I]]#0
i = 0
! CHECK: %[[V_3:[0-9]+]] = llvm.intr.stacksave : !llvm.ptr
- ! CHECK: fir.store %{{.*}} to %[[V_1]] : !fir.ref<i32>
- ! CHECK: br ^bb1
+ ! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
+ ! CHECK: cf.br ^bb1
! CHECK: ^bb1: // 2 preds: ^bb0, ^bb16
- ! CHECK: cond_br %{{.*}}, ^bb2, ^bb17
+ ! CHECK: cf.cond_br %{{.*}}, ^bb2, ^bb17
! CHECK: ^bb2: // pred: ^bb1
! CHECK: %[[V_11:[0-9]+]] = llvm.intr.stacksave : !llvm.ptr
- ! CHECK: fir.store %{{.*}} to %[[V_1]] : !fir.ref<i32>
- ! CHECK: cond_br %{{.*}}, ^bb3, ^bb4
+ ! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
+ ! CHECK: cf.cond_br %{{.*}}, ^bb3, ^bb4
! CHECK: ^bb3: // pred: ^bb2
- ! CHECK: br ^bb10
+ ! CHECK: cf.br ^bb10
! CHECK: ^bb4: // pred: ^bb2
- ! CHECK: fir.store %{{.*}} to %[[V_1]] : !fir.ref<i32>
- ! CHECK: cond_br %{{.*}}, ^bb5, ^bb6
+ ! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
+ ! CHECK: cf.cond_br %{{.*}}, ^bb5, ^bb6
! CHECK: ^bb5: // pred: ^bb4
- ! CHECK: br ^bb14
+ ! CHECK: cf.br ^bb14
! CHECK: ^bb6: // pred: ^bb4
- ! CHECK: fir.store %{{.*}} to %[[V_1]] : !fir.ref<i32>
- ! CHECK: cond_br %{{.*}}, ^bb7, ^bb8
+ ! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
+ ! CHECK: cf.cond_br %{{.*}}, ^bb7, ^bb8
! CHECK: ^bb7: // pred: ^bb6
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
- ! CHECK: br ^bb15
+ ! CHECK: cf.br ^bb15
! CHECK: ^bb8: // pred: ^bb6
- ! CHECK: fir.store %{{.*}} to %[[V_1]] : !fir.ref<i32>
- ! CHECK: cond_br %{{.*}}, ^bb9, ^bb10
+ ! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
+ ! CHECK: cf.cond_br %{{.*}}, ^bb9, ^bb10
! CHECK: ^bb9: // pred: ^bb8
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
- ! CHECK: br ^bb16
+ ! CHECK: cf.br ^bb16
! CHECK: ^bb10: // 2 preds: ^bb3, ^bb8
- ! CHECK: fir.store %{{.*}} to %[[V_1]] : !fir.ref<i32>
- ! CHECK: cond_br %{{.*}}, ^bb11, ^bb12
+ ! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
+ ! CHECK: cf.cond_br %{{.*}}, ^bb11, ^bb12
! CHECK: ^bb11: // pred: ^bb10
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
- ! CHECK: br ^bb18
+ ! CHECK: cf.br ^bb18
! CHECK: ^bb12: // pred: ^bb10
- ! CHECK: fir.store %{{.*}} to %[[V_1]] : !fir.ref<i32>
- ! CHECK: cond_br %{{.*}}, ^bb13, ^bb14
+ ! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
+ ! CHECK: cf.cond_br %{{.*}}, ^bb13, ^bb14
! CHECK: ^bb13: // pred: ^bb12
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
! CHECK: llvm.intr.stackrestore %[[V_3]] : !llvm.ptr
- ! CHECK: br ^bb19
+ ! CHECK: cf.br ^bb19
! CHECK: ^bb14: // 2 preds: ^bb5, ^bb12
! CHECK: llvm.intr.stackrestore %[[V_11]] : !llvm.ptr
- ! CHECK: br ^bb15
+ ! CHECK: cf.br ^bb15
! CHECK: ^bb15: // 2 preds: ^bb7, ^bb14
- ! CHECK: br ^bb16
+ ! CHECK: cf.br ^bb16
! CHECK: ^bb16: // 2 preds: ^bb9, ^bb15
- ! CHECK: br ^bb1
+ ! CHECK: cf.br ^bb1
! CHECK: ^bb17: // pred: ^bb1
- ! CHECK: fir.store %{{.*}} to %[[V_1]] : !fir.ref<i32>
+ ! CHECK: hlfir.assign %{{.*}} to %[[V_I]]#0
! CHECK: cf.br ^bb18
! CHECK: ^bb18: // 2 preds: ^bb11, ^bb17
! CHECK: llvm.intr.stackrestore %[[V_3]] : !llvm.ptr
- ! CHECK: br ^bb19
+ ! CHECK: cf.br ^bb19
! CHECK: ^bb19: // 2 preds: ^bb13, ^bb18
block
i = i + 1 ! 1 increment
@@ -80,8 +80,9 @@ program bb ! block stack management and exits
100 print*, i ! expect 21
! CHECK: %[[V_51:[0-9]+]] = llvm.intr.stacksave : !llvm.ptr
- ! CHECK: fir.store %c5{{.*}} to %[[V_0]] : !fir.ref<i32>
- ! CHECK: fir.call @ss(%[[V_0]]) proc_attrs<bind_c> fastmath<contract> : (!fir.ref<i32>) -> ()
+ ! CHECK: %[[ASSOC:[0-9]+]]:3 = hlfir.associate %c5{{.*}} {adapt.valuebyref} : (i32) -> (!fir.ref<i32>, !fir.ref<i32>, i1)
+ ! CHECK: fir.call @ss(%[[ASSOC]]#0) proc_attrs<bind_c> fastmath<contract> : (!fir.ref<i32>) -> ()
+ ! CHECK: hlfir.end_associate %[[ASSOC]]#1, %[[ASSOC]]#2 : !fir.ref<i32>, i1
! CHECK: llvm.intr.stackrestore %[[V_51]] : !llvm.ptr
block
interface
diff --git a/flang/test/Lower/call-copy-in-out.f90 b/flang/test/Lower/call-copy-in-out.f90
index 65141dcb7c5fe..fa2182ac11bac 100644
--- a/flang/test/Lower/call-copy-in-out.f90
+++ b/flang/test/Lower/call-copy-in-out.f90
@@ -1,107 +1,60 @@
! Test copy-in / copy-out of non-contiguous variable passed as F77 array arguments.
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc -emit-hlfir -o - %s | FileCheck %s
! Nominal test
! CHECK-LABEL: func @_QPtest_assumed_shape_to_array(
! CHECK-SAME: %[[x:.*]]: !fir.box<!fir.array<?xf32>>{{.*}}) {
subroutine test_assumed_shape_to_array(x)
real :: x(:)
-
-! CHECK: %[[box_none:.*]] = fir.convert %[[x]] : (!fir.box<!fir.array<?xf32>>) -> !fir.box<none>
-! CHECK: %[[is_contiguous:.*]] = fir.call @_FortranAIsContiguous(%[[box_none]]) {{.*}}: (!fir.box<none>) -> i1
-! CHECK: %[[addr:.*]] = fir.if %[[is_contiguous]] -> (!fir.heap<!fir.array<?xf32>>) {
-! CHECK: %[[box_addr:.*]] = fir.box_addr %[[x]] : (!fir.box<!fir.array<?xf32>>) -> !fir.heap<!fir.array<?xf32>>
-! CHECK: fir.result %[[box_addr]] : !fir.heap<!fir.array<?xf32>>
-! CHECK: } else {
-! Creating temp
-! CHECK: %[[dim:.*]]:3 = fir.box_dims %[[x:.*]], %c0{{.*}} : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
-! CHECK: %[[temp:.*]] = fir.allocmem !fir.array<?xf32>, %[[dim]]#1 {uniq_name = ".copyinout"}
-
-! Copy-in
-! CHECK-DAG: %[[shape:.*]] = fir.shape %[[dim]]#1 : (index) -> !fir.shape<1>
-! CHECK-DAG: %[[temp_box:.*]] = fir.embox %[[temp]](%[[shape]]) : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xf32>>
-! CHECK-DAG: fir.store %[[temp_box]] to %[[temp_box_loc:.*]] : !fir.ref<!fir.box<!fir.array<?xf32>>>
-! CHECK-DAG: %[[temp_box_addr:.*]] = fir.convert %[[temp_box_loc]] : (!fir.ref<!fir.box<!fir.array<?xf32>>>) -> !fir.ref<!fir.box<none>>
-! CHECK-DAG: %[[arg_box:.*]] = fir.convert %[[x]] : (!fir.box<!fir.array<?xf32>>) -> !fir.box<none>
-! CHECK-DAG: fir.call @_FortranAAssignTemporary(%[[temp_box_addr]], %[[arg_box]], %{{.*}}, %{{.*}}){{.*}}: (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> ()
-! CHECK: fir.result %[[temp]] : !fir.heap<!fir.array<?xf32>>
-
-! CHECK: %[[dim:.*]]:3 = fir.box_dims %[[x]], %c0{{.*}} : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
-! CHECK: %[[cast:.*]] = fir.convert %[[addr]] : (!fir.heap<!fir.array<?xf32>>) -> !fir.ref<!fir.array<?xf32>>
-! CHECK: fir.call @_QPbar(%[[cast]]) {{.*}}: (!fir.ref<!fir.array<?xf32>>) -> ()
-
-! Copy-out
-! CHECK-DAG: %[[shape:.*]] = fir.shape %[[dim]]#1 : (index) -> !fir.shape<1>
-! CHECK-DAG: %[[temp_box:.*]] = fir.embox %[[addr]](%[[shape]]) : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xf32>>
-! CHECK: %[[rebox:.*]] = fir.rebox %[[temp_box]] : (!fir.box<!fir.array<?xf32>>) -> !fir.box<!fir.heap<!fir.array<?xf32>>>
-! CHECK: fir.store %[[rebox]] to %[[temp_box_ref:.*]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
-! CHECK-DAG: fir.store %[[x]] to %[[arg_box_loc:.*]] : !fir.ref<!fir.box<!fir.array<?xf32>>>
-! CHECK-DAG: %[[arg_box_addr:.*]] = fir.convert %[[arg_box_loc]] : (!fir.ref<!fir.box<!fir.array<?xf32>>>) -> !fir.ref<!fir.box<none>>
-! CHECK-DAG: %[[temp_box_cast:.*]] = fir.convert %[[temp_box_ref]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>>
-! CHECK-DAG: fir.call @_FortranACopyOutAssign(%[[arg_box_addr]], %[[temp_box_cast]], %{{.*}}, %{{.*}}){{.*}}: (!fir.ref<!fir.box<none>>, !fir.ref<!fir.box<none>>, !fir.ref<i8>, i32) -> ()
-
+! CHECK: %[[x_decl:.*]]:2 = hlfir.declare %[[x]]
+! CHECK: %[[copy_in:.*]]:2 = hlfir.copy_in %[[x_decl]]#0 {{.*}}
+! CHECK: %[[addr:.*]] = fir.box_addr %[[copy_in]]#0
+! CHECK: fir.call @_QPbar(%[[addr]])
+! CHECK: hlfir.copy_out %{{.*}}, %[[copy_in]]#1 to %[[x_decl]]#0
call bar(x)
end subroutine
! Test that copy-in/copy-out does not trigger the re-evaluation of
! the designator expression.
! CHECK-LABEL: func @_QPeval_expr_only_once(
-! CHECK-SAME: %[[x:.*]]: !fir.ref<!fir.array<200xf32>>{{.*}}) {
subroutine eval_expr_only_once(x)
integer :: only_once
real :: x(200)
! CHECK: fir.call @_QPonly_once()
-! CHECK: %[[x_section:.*]] = fir.embox %[[x]](%{{.*}}) [%{{.*}}] : (!fir.ref<!fir.array<200xf32>>, !fir.shape<1>, !fir.slice<1>) -> !fir.box<!fir.array<?xf32>>
-! CHECK: %[[box_none:.*]] = fir.convert %[[x_section]] : (!fir.box<!fir.array<?xf32>>) -> !fir.box<none>
-! CHECK: %[[is_contiguous:.*]] = fir.call @_FortranAIsContiguous(%[[box_none]]) {{.*}}: (!fir.box<none>) -> i1
-! CHECK: %[[addr:.*]] = fir.if %[[is_contiguous]] -> (!fir.heap<!fir.array<?xf32>>) {
-
-! CHECK: %[[temp:.*]] = fir.allocmem !fir.array<?xf32>
-! CHECK-NOT: fir.call @_QPonly_once()
-! CHECK: fir.call @_FortranAAssignTemporary
+! CHECK: hlfir.designate
+! CHECK: hlfir.copy_in
! CHECK-NOT: fir.call @_QPonly_once()
-
-! CHECK: %[[cast:.*]] = fir.convert %[[addr]] : (!fir.heap<!fir.array<?xf32>>) -> !fir.ref<!fir.array<?xf32>>
-! CHECK: fir.call @_QPbar(%[[cast]]) {{.*}}: (!fir.ref<!fir.array<?xf32>>) -> ()
- call bar(x(1:200:only_once()))
-
+! CHECK: fir.call @_QPbar
! CHECK-NOT: fir.call @_QPonly_once()
-! CHECK: fir.call @_FortranACopyOutAssign
+! CHECK: hlfir.copy_out
! CHECK-NOT: fir.call @_QPonly_once()
-
+ call bar(x(1:200:only_once()))
end subroutine
! Test no copy-in/copy-out is generated for contiguous assumed shapes.
! CHECK-LABEL: func @_QPtest_contiguous(
-! CHECK-SAME: %[[x:.*]]: !fir.box<!fir.array<?xf32>>
subroutine test_contiguous(x)
real, contiguous :: x(:)
-! CHECK: %[[addr:.*]] = fir.box_addr %[[x]] : (!fir.box<!fir.array<?xf32>>) -> !fir.ref<!fir.array<?xf32>>
-! CHECK-NOT: fir.call @_FortranAAssignTemporary
-! CHECK: fir.call @_QPbar(%[[addr]]) {{.*}}: (!fir.ref<!fir.array<?xf32>>) -> ()
+! CHECK-NOT: hlfir.copy_in
+! CHECK: fir.call @_QPbar
+! CHECK-NOT: hlfir.copy_out
call bar(x)
-! CHECK-NOT: fir.call @_FortranACopyOutAssign
-! CHECK: return
end subroutine
! Test the parenthesis are preventing copy-out.
-! CHECK: func @_QPtest_parenthesis(
-! CHECK: %[[x:.*]]: !fir.box<!fir.array<?xf32>>{{.*}}) {
+! CHECK-LABEL: func @_QPtest_parenthesis(
subroutine test_parenthesis(x)
real :: x(:)
-! CHECK: %[[dim:.*]]:3 = fir.box_dims %[[x]], %c0{{.*}} : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
-! CHECK: %[[temp:.*]] = fir.allocmem !fir.array<?xf32>, %[[dim]]#1 {uniq_name = ".array.expr"}
-! CHECK: fir.array_merge_store %{{.*}}, %{{.*}} to %[[temp]]
-! CHECK: %[[cast:.*]] = fir.convert %[[temp]] : (!fir.heap<!fir.array<?xf32>>) -> !fir.ref<!fir.array<?xf32>>
-! CHECK: fir.call @_QPbar(%[[cast]]) {{.*}}: (!fir.ref<!fir.array<?xf32>>) -> ()
+! CHECK: hlfir.elemental
+! CHECK: hlfir.associate
+! CHECK: fir.call @_QPbar
+! CHECK: hlfir.end_associate
+! CHECK-NOT: hlfir.copy_out
call bar((x))
-! CHECK-NOT: fir.call @_FortranACopyOutAssign
-! CHECK: return
end subroutine
! Test copy-in in is skipped for intent(out) arguments.
-! CHECK: func @_QPtest_intent_out(
-! CHECK: %[[x:.*]]: !fir.box<!fir.array<?xf32>>{{.*}}) {
+! CHECK-LABEL: func @_QPtest_intent_out(
subroutine test_intent_out(x)
real :: x(:)
interface
@@ -109,26 +62,14 @@ subroutine bar_intent_out(x)
real, intent(out) :: x(100)
end subroutine
end interface
-! CHECK: %[[box_none:.*]] = fir.convert %[[x]] : (!fir.box<!fir.array<?xf32>>) -> !fir.box<none>
-! CHECK: %[[is_contiguous:.*]] = fir.call @_FortranAIsContiguous(%[[box_none]]) {{.*}}: (!fir.box<none>) -> i1
-! CHECK: %[[addr:.*]] = fir.if %[[is_contiguous]]
-! CHECK: } else {
-! CHECK: %[[dim:.*]]:3 = fir.box_dims %[[x]], %c0{{.*}} : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
-! CHECK: %[[temp:.*]] = fir.allocmem !fir.array<?xf32>, %[[dim]]#1
-! CHECK-NOT: fir.call @_FortranAAssignTemporary
-! CHECK: %[[not_contiguous:.*]] = arith.cmpi eq, %[[is_contiguous]], %false{{.*}} : i1
-! CHECK: %[[cast:.*]] = fir.convert %[[addr]] : (!fir.heap<!fir.array<?xf32>>) -> !fir.ref<!fir.array<100xf32>>
-! CHECK: fir.call @_QPbar_intent_out(%[[cast]]) {{.*}}: (!fir.ref<!fir.array<100xf32>>) -> ()
+! CHECK: hlfir.copy_in
+! CHECK: fir.call @_QPbar_intent_out
+! CHECK: hlfir.copy_out
call bar_intent_out(x)
-
-! CHECK: fir.if %[[not_contiguous]]
-! CHECK: fir.call @_FortranACopyOutAssign
-! CHECK: return
end subroutine
! Test copy-out is skipped for intent(out) arguments.
! CHECK-LABEL: func.func @_QPtest_intent_in(
-! CHECK: %[[x:.*]]: !fir.box<!fir.array<?xf32>>{{.*}}) {
subroutine test_intent_in(x)
real :: x(:)
interface
@@ -136,30 +77,15 @@ subroutine bar_intent_in(x)
real, intent(in) :: x(100)
end subroutine
end interface
-! CHECK: %[[box_none:.*]] = fir.convert %[[x]] : (!fir.box<!fir.array<?xf32>>) -> !fir.box<none>
-! CHECK: %[[is_contiguous:.*]] = fir.call @_FortranAIsContiguous(%[[box_none]]) {{.*}}: (!fir.box<none>) -> i1
-! CHECK: %[[addr:.*]] = fir.if %[[is_contiguous]]
-! CHECK: } else {
-! CHECK: %[[dim:.*]]:3 = fir.box_dims %[[x]], %c0{{.*}} : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
-! CHECK: %[[temp:.*]] = fir.allocmem !fir.array<?xf32>, %[[dim]]#1
-! CHECK: %[[temp_shape:.*]] = fir.shape %[[dim]]#1 : (index) -> !fir.shape<1>
-! CHECK: %[[temp_box:.*]] = fir.embox %[[temp]](%[[temp_shape]]) : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xf32>>
-! CHECK: fir.store %[[temp_box]] to %[[temp_box_loc:.*]] : !fir.ref<!fir.box<!fir.array<?xf32>>>
-! CHECK: %[[temp_box_addr:.*]] = fir.convert %[[temp_box_loc]] : (!fir.ref<!fir.box<!fir.array<?xf32>>>) -> !fir.ref<!fir.box<none>>
-! CHECK: fir.call @_FortranAAssignTemporary(%[[temp_box_addr]],
-! CHECK: %[[not_contiguous:.*]] = arith.cmpi eq, %[[is_contiguous]], %false{{.*}} : i1
-! CHECK: %[[cast:.*]] = fir.convert %[[addr]] : (!fir.heap<!fir.array<?xf32>>) -> !fir.ref<!fir.array<100xf32>>
-! CHECK: fir.call @_QPbar_intent_in(%[[cast]]) {{.*}}: (!fir.ref<!fir.array<100xf32>>) -> ()
+! CHECK: hlfir.copy_in
+! CHECK: fir.call @_QPbar_intent_in
+! CHECK: hlfir.copy_out
+! CHECK-SAME: ) -> ()
call bar_intent_in(x)
-! CHECK: fir.if %[[not_contiguous]]
-! CHECK: fir.zero
-! CHECK: fir.call @_FortranACopyOutAssign
-! CHECK: return
end subroutine
! Test copy-in/copy-out is done for intent(inout)
-! CHECK: func @_QPtest_intent_inout(
-! CHECK: %[[x:.*]]: !fir.box<!fir.array<?xf32>>{{.*}}) {
+! CHECK-LABEL: func @_QPtest_intent_inout(
subroutine test_intent_inout(x)
real :: x(:)
interface
@@ -167,111 +93,55 @@ subroutine bar_intent_inout(x)
real, intent(inout) :: x(100)
end subroutine
end interface
-! CHECK: %[[box_none:.*]] = fir.convert %[[x]] : (!fir.box<!fir.array<?xf32>>) -> !fir.box<none>
-! CHECK: %[[is_contiguous:.*]] = fir.call @_FortranAIsContiguous(%[[box_none]]) {{.*}}: (!fir.box<none>) -> i1
-! CHECK: %[[addr:.*]] = fir.if %[[is_contiguous]]
-! CHECK: } else {
-! CHECK: %[[dim:.*]]:3 = fir.box_dims %[[x]], %c0{{.*}} : (!fir.box<!fir.array<?xf32>>, index) -> (index, index, index)
-! CHECK: %[[temp:.*]] = fir.allocmem !fir.array<?xf32>, %[[dim]]#1
-! CHECK: fir.call @_FortranAAssign
-! CHECK: %[[not_contiguous:.*]] = arith.cmpi eq, %[[is_contiguous]], %false{{.*}} : i1
-! CHECK: %[[cast:.*]] = fir.convert %[[addr]] : (!fir.heap<!fir.array<?xf32>>) -> !fir.ref<!fir.array<100xf32>>
-! CHECK: fir.call @_QPbar_intent_inout(%[[cast]]) {{.*}}: (!fir.ref<!fir.array<100xf32>>) -> ()
+! CHECK: hlfir.copy_in
+! CHECK: fir.call @_QPbar_intent_inout
+! CHECK: hlfir.copy_out
+! CHECK-SAME: to
call bar_intent_inout(x)
-! CHECK: fir.if %[[not_contiguous]]
-! CHECK: fir.call @_FortranACopyOutAssign
-! CHECK: return
end subroutine
! Test characters are handled correctly
! CHECK-LABEL: func @_QPtest_char(
-! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?x!fir.char<1,10>>>{{.*}}) {
subroutine test_char(x)
-! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.box<!fir.array<?x!fir.char<1,10>>>
-! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.box<!fir.array<?x!fir.char<1,10>>>
-! CHECK: %[[VAL_3:.*]] = arith.constant 10 : index
-! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_0]] : (!fir.box<!fir.array<?x!fir.char<1,10>>>) -> !fir.box<none>
-! CHECK: %[[VAL_5:.*]] = fir.call @_FortranAIsContiguous(%[[VAL_4]]) fastmath<contract> : (!fir.box<none>) -> i1
-! CHECK: %[[VAL_6:.*]] = fir.if %[[VAL_5]] -> (!fir.heap<!fir.array<?x!fir.char<1,10>>>) {
-! CHECK: %[[VAL_7:.*]] = fir.box_addr %[[VAL_0]] : (!fir.box<!fir.array<?x!fir.char<1,10>>>) -> !fir.heap<!fir.array<?x!fir.char<1,10>>>
-! CHECK: fir.result %[[VAL_7]] : !fir.heap<!fir.array<?x!fir.char<1,10>>>
-! CHECK: } else {
-! CHECK: %[[VAL_8:.*]] = arith.constant 0 : index
-! CHECK: %[[VAL_9:.*]]:3 = fir.box_dims %[[VAL_0]], %[[VAL_8]] : (!fir.box<!fir.array<?x!fir.char<1,10>>>, index) -> (index, index, index)
-! CHECK: %[[VAL_10:.*]] = fir.allocmem !fir.array<?x!fir.char<1,10>>, %[[VAL_9]]#1 {uniq_name = ".copyinout"}
-! CHECK: %[[VAL_11:.*]] = fir.shape %[[VAL_9]]#1 : (index) -> !fir.shape<1>
-! CHECK: %[[VAL_12:.*]] = fir.embox %[[VAL_10]](%[[VAL_11]]) : (!fir.heap<!fir.array<?x!fir.char<1,10>>>, !fir.shape<1>) -> !fir.box<!fir.array<?x!fir.char<1,10>>>
-! CHECK: fir.store %[[VAL_12]] to %[[VAL_2]] : !fir.ref<!fir.box<!fir.array<?x!fir.char<1,10>>>>
-! CHECK: %[[VAL_15:.*]] = fir.convert %[[VAL_2]] : (!fir.ref<!fir.box<!fir.array<?x!fir.char<1,10>>>>) -> !fir.ref<!fir.box<none>>
-! CHECK: %[[VAL_16:.*]] = fir.convert %[[VAL_0]] : (!fir.box<!fir.array<?x!fir.char<1,10>>>) -> !fir.box<none>
-! CHECK: fir.call @_FortranAAssignTemporary(%[[VAL_15]], %[[VAL_16]], %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> ()
-! CHECK: fir.result %[[VAL_10]] : !fir.heap<!fir.array<?x!fir.char<1,10>>>
-! CHECK: }
-! CHECK: %[[VAL_19:.*]] = arith.constant 0 : index
-! CHECK: %[[VAL_20:.*]]:3 = fir.box_dims %[[VAL_0]], %[[VAL_19]] : (!fir.box<!fir.array<?x!fir.char<1,10>>>, index) -> (index, index, index)
-! CHECK: %[[VAL_21:.*]] = arith.constant false
-! CHECK: %[[VAL_22:.*]] = arith.cmpi eq, %[[VAL_5]], %[[VAL_21]] : i1
-! CHECK: %[[VAL_23:.*]] = fir.convert %[[VAL_24:.*]] : (!fir.heap<!fir.array<?x!fir.char<1,10>>>) -> !fir.ref<!fir.char<1,?>>
-! CHECK: %[[VAL_25:.*]] = fir.emboxchar %[[VAL_23]], %[[VAL_3]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
-! CHECK: fir.call @_QPbar_char(%[[VAL_25]]) fastmath<contract> : (!fir.boxchar<1>) -> ()
-! CHECK: fir.if %[[VAL_22]] {
-! CHECK: %[[VAL_26:.*]] = fir.shape %[[VAL_20]]#1 : (index) -> !fir.shape<1>
-! CHECK: %[[VAL_27:.*]] = fir.embox %[[VAL_24]](%[[VAL_26]]) : (!fir.heap<!fir.array<?x!fir.char<1,10>>>, !fir.shape<1>) -> !fir.box<!fir.array<?x!fir.char<1,10>>>
-! CHECK: %[[REBOX:.*]] = fir.rebox %[[VAL_27]] : (!fir.box<!fir.array<?x!fir.char<1,10>>>) -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>
-! CHECK: fir.store %[[REBOX]] to %[[TMP_BOX_REF:.*]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>>
-! CHECK: fir.store %[[VAL_0]] to %[[VAL_1]] : !fir.ref<!fir.box<!fir.array<?x!fir.char<1,10>>>>
-! CHECK: %[[VAL_31:.*]] = fir.convert %[[VAL_1]] : (!fir.ref<!fir.box<!fir.array<?x!fir.char<1,10>>>>) -> !fir.ref<!fir.box<none>>
-! CHECK: %[[VAL_32:.*]] = fir.convert %[[TMP_BOX_REF]] : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>>) -> !fir.ref<!fir.box<none>>
-! CHECK: fir.call @_FortranACopyOutAssign(%[[VAL_31]], %[[VAL_32]], %{{.*}}, %{{.*}}) fastmath<contract> : (!fir.ref<!fir.box<none>>, !fir.ref<!fir.box<none>>, !fir.ref<i8>, i32) -> ()
-! CHECK: }
-
character(10) :: x(:)
+! CHECK: hlfir.copy_in
+! CHECK: fir.call @_QPbar_char
+! CHECK: hlfir.copy_out
call bar_char(x)
- ! CHECK: return
- ! CHECK: }
end subroutine test_char
! CHECK-LABEL: func @_QPtest_scalar_substring_does_no_trigger_copy_inout
-! CHECK-SAME: %[[arg0:.*]]: !fir.boxchar<1>
subroutine test_scalar_substring_does_no_trigger_copy_inout(c, i, j)
character(*) :: c
integer :: i, j
- ! CHECK: %[[unbox:.*]]:2 = fir.unboxchar %[[arg0]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
- ! CHECK: %[[c:.*]] = fir.convert %[[unbox]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.array<?x!fir.char<1>>>
- ! CHECK: %[[coor:.*]] = fir.coordinate_of %[[c]], %{{.*}} : (!fir.ref<!fir.array<?x!fir.char<1>>>, index) -> !fir.ref<!fir.char<1>>
- ! CHECK: %[[substr:.*]] = fir.convert %[[coor]] : (!fir.ref<!fir.char<1>>) -> !fir.ref<!fir.char<1,?>>
- ! CHECK: %[[boxchar:.*]] = fir.emboxchar %[[substr]], %{{.*}} : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
- ! CHECK: fir.call @_QPbar_char_2(%[[boxchar]]) {{.*}}: (!fir.boxchar<1>) -> ()
+ ! CHECK: hlfir.designate
+ ! CHECK-NOT: hlfir.copy_in
+ ! CHECK: fir.call @_QPbar_char_2
+ ! CHECK-NOT: hlfir.copy_out
call bar_char_2(c(i:j))
end subroutine
! CHECK-LABEL: func @_QPissue871(
-! CHECK-SAME: %[[p:.*]]: !fir.ref<!fir.box<!fir.ptr<!fir.type<_QFissue871Tt{i:i32}>>>>{{.*}})
subroutine issue871(p)
! Test passing implicit derived from scalar pointer (no copy-in/out).
type t
integer :: i
end type t
type(t), pointer :: p
- ! CHECK: %[[box_load:.*]] = fir.load %[[p]]
- ! CHECK: %[[addr:.*]] = fir.box_addr %[[box_load]]
- ! CHECK: %[[cast:.*]] = fir.convert %[[addr]]
- ! CHECK: fir.call @_QPbar_derived(%[[cast]])
+ ! CHECK-NOT: hlfir.copy_in
+ ! CHECK: fir.call @_QPbar_derived
call bar_derived(p)
end subroutine
! CHECK-LABEL: func @_QPissue871_array(
-! CHECK-SAME: %[[p:.*]]: !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.type<_QFissue871_arrayTt{i:i32}>>>>>
subroutine issue871_array(p)
! Test passing implicit derived from contiguous pointer (no copy-in/out).
type t
integer :: i
end type t
type(t), pointer, contiguous :: p(:)
- ! CHECK: %[[box_load:.*]] = fir.load %[[p]]
- ! CHECK: %[[addr:.*]] = fir.box_addr %[[box_load]]
- ! CHECK: %[[cast:.*]] = fir.convert %[[addr]]
- ! CHECK: fir.call @_QPbar_derived_array(%[[cast]])
+ ! CHECK-NOT: hlfir.copy_in
+ ! CHECK: fir.call @_QPbar_derived_array
call bar_derived_array(p)
end subroutine
@@ -281,10 +151,10 @@ subroutine whole_components()
type t
integer :: i(100)
end type
- ! CHECK: %[[a:.*]] = fir.alloca !fir.type<_QFwhole_componentsTt{i:!fir.array<100xi32>}>
type(t) :: a
- ! CHECK: %[[addr:.*]] = fir.coordinate_of %[[a]], i : (!fir.ref<!fir.type<_QFwhole_componentsTt{i:!fir.array<100xi32>}>>) -> !fir.ref<!fir.array<100xi32>>
- ! CHECK: fir.call @_QPbar_integer(%[[addr]]) {{.*}}: (!fir.ref<!fir.array<100xi32>>) -> ()
+ ! CHECK: hlfir.designate
+ ! CHECK-NOT: hlfir.copy_in
+ ! CHECK: fir.call @_QPbar_integer
call bar_integer(a%i)
end subroutine
@@ -294,13 +164,10 @@ subroutine whole_component_contiguous_pointer()
type t
integer, pointer, contiguous :: i(:)
end type
- ! CHECK: %[[a:.*]] = fir.alloca !fir.type<_QFwhole_component_contiguous_pointerTt{i:!fir.box<!fir.ptr<!fir.array<?xi32>>>}>
type(t) :: a
- ! CHECK: %[[coor:.*]] = fir.coordinate_of %[[a]], i : (!fir.ref<!fir.type<_QFwhole_component_contiguous_pointerTt{i:!fir.box<!fir.ptr<!fir.array<?xi32>>>}>>) -> !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>
- ! CHECK: %[[box_load:.*]] = fir.load %[[coor]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>
- ! CHECK: %[[addr:.*]] = fir.box_addr %[[box_load]] : (!fir.box<!fir.ptr<!fir.array<?xi32>>>) -> !fir.ptr<!fir.array<?xi32>>
- ! CHECK: %[[cast:.*]] = fir.convert %[[addr]] : (!fir.ptr<!fir.array<?xi32>>) -> !fir.ref<!fir.array<100xi32>>
- ! CHECK: fir.call @_QPbar_integer(%[[cast]]) {{.*}}: (!fir.ref<!fir.array<100xi32>>) -> ()
+ ! CHECK: hlfir.designate
+ ! CHECK-NOT: hlfir.copy_in
+ ! CHECK: fir.call @_QPbar_integer
call bar_integer(a%i)
end subroutine
@@ -310,14 +177,9 @@ subroutine whole_component_contiguous_char_pointer()
type t
character(:), pointer, contiguous :: i(:)
end type
- ! CHECK: %[[a:.*]] = fir.alloca !fir.type<_QFwhole_component_contiguous_char_pointerTt{i:!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>}>
type(t) :: a
- ! CHECK: %[[coor:.*]] = fir.coordinate_of %[[a]], i : (!fir.ref<!fir.type<_QFwhole_component_contiguous_char_pointerTt{i:!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>}>>) -> !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>>
- ! CHECK: %[[box_load:.*]] = fir.load %[[coor]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>>
- ! CHECK: %[[addr:.*]] = fir.box_addr %[[box_load]] : (!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>) -> !fir.ptr<!fir.array<?x!fir.char<1,?>>>
- ! CHECK: %[[len:.*]] = fir.box_elesize %[[box_load]] : (!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>) -> index
- ! CHECK: %[[cast:.*]] = fir.convert %[[addr]] : (!fir.ptr<!fir.array<?x!fir.char<1,?>>>) -> !fir.ref<!fir.char<1,?>>
- ! CHECK: %[[embox:.*]] = fir.emboxchar %[[cast]], %[[len]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
- ! CHECK: fir.call @_QPbar_char_3(%[[embox]]) {{.*}}: (!fir.boxchar<1>) -> ()
+ ! CHECK: hlfir.designate
+ ! CHECK-NOT: hlfir.copy_in
+ ! CHECK: fir.call @_QPbar_char_3
call bar_char_3(a%i)
end subroutine
diff --git a/flang/test/Lower/call-implicit.f90 b/flang/test/Lower/call-implicit.f90
index 0a677ce512a78..038c326ae09de 100644
--- a/flang/test/Lower/call-implicit.f90
+++ b/flang/test/Lower/call-implicit.f90
@@ -1,13 +1,19 @@
-! RUN: bbc %s -o "-" -emit-fir -hlfir=false | FileCheck %s
+! RUN: bbc %s -o "-" -emit-hlfir | FileCheck %s
! Test lowering of calls to procedures with implicit interfaces using different
! calls with different argument types, one of which is character
subroutine s2
integer i(3)
! CHECK: %[[a0:.*]] = fir.alloca !fir.array<3xi32> {bindc_name = "i", uniq_name = "_QFs2Ei"}
- ! CHECK: fir.call @_QPsub2(%[[a0]]) {{.*}}: (!fir.ref<!fir.array<3xi32>>) -> ()
+! CHECK: %[[decl:.*]]:2 = hlfir.declare %[[a0]]
+ ! CHECK: fir.call @_QPsub2(%[[decl]]#0) {{.*}}: (!fir.ref<!fir.array<3xi32>>) -> ()
call sub2(i)
! CHECK: %[[a1:.*]] = fir.address_of(@_QQclX3031323334) : !fir.ref<!fir.char<1,5>>
-! CHECK: %[[a2:.*]] = fir.convert %[[a1]] : (!fir.ref<!fir.char<1,5>>) -> !fir.ref<!fir.array<3xi32>>
- ! CHECK: fir.call @_QPsub2(%[[a2]]) {{.*}}: (!fir.ref<!fir.array<3xi32>>) -> ()
+! CHECK: %[[decl_char:.*]]:2 = hlfir.declare %[[a1]]
+! CHECK: %[[expr:.*]] = hlfir.as_expr %[[decl_char]]#0
+! CHECK: %[[assoc:.*]]:3 = hlfir.associate %[[expr]] {{.*}} {adapt.valuebyref}
+! CHECK: %[[embox:.*]] = fir.emboxchar %[[assoc]]#0
+! CHECK: %[[func:.*]] = fir.address_of(@_QPsub2)
+! CHECK: %[[cast_func:.*]] = fir.convert %[[func]]
+ ! CHECK: fir.call %[[cast_func]](%[[embox]]) {{.*}}: (!fir.boxchar<1>) -> ()
call sub2("01234")
end
diff --git a/flang/test/Lower/call.f90 b/flang/test/Lower/call.f90
index dc5120c6eb226..f9474d35986d8 100644
--- a/flang/test/Lower/call.f90
+++ b/flang/test/Lower/call.f90
@@ -1,7 +1,7 @@
! Test various aspects around call lowering. More detailed tests around core
! requirements are done in call-xxx.f90 and dummy-argument-xxx.f90 files.
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
! CHECK-LABEL: func @_QPtest_nested_calls
subroutine test_nested_calls()
@@ -12,10 +12,10 @@ subroutine foo(i)
integer function bar()
end function
end interface
- ! CHECK: %[[result_storage:.*]] = fir.alloca i32 {adapt.valuebyref}
! CHECK: %[[result:.*]] = fir.call @_QPbar() {{.*}}: () -> i32
- ! CHECK: fir.store %[[result]] to %[[result_storage]] : !fir.ref<i32>
- ! CHECK: fir.call @_QPfoo(%[[result_storage]]) {{.*}}: (!fir.ref<i32>) -> ()
+ ! CHECK: %[[assoc:.*]]:3 = hlfir.associate %[[result]] {adapt.valuebyref} : (i32) -> (!fir.ref<i32>, !fir.ref<i32>, i1)
+ ! CHECK: fir.call @_QPfoo(%[[assoc]]#0) {{.*}}: (!fir.ref<i32>) -> ()
+ ! CHECK: hlfir.end_associate %[[assoc]]#1, %[[assoc]]#2 : !fir.ref<i32>, i1
call foo(bar())
end subroutine
@@ -46,17 +46,20 @@ function f_int_to_char(i) bind(c, name="f_int_to_char")
! CHECK-LABEL: func.func @f_int_to_char(
! CHECK-SAME: %[[ARG0:.*]]: i32 {fir.bindc_name = "i"}) -> !fir.char<1> attributes {fir.bindc_name = "f_int_to_char", fir.proc_attrs = #fir.proc_attrs<bind_c>} {
-! CHECK: %[[CHARBOX:.*]] = fir.alloca !fir.char<1> {adapt.valuebyref}
+! CHECK: %[[TEMP:.*]] = fir.alloca !fir.char<1>
! CHECK: %[[RESULT:.*]] = fir.alloca !fir.char<1> {bindc_name = "f_int_to_char", uniq_name = "_QFf_int_to_charEf_int_to_char"}
+! CHECK: %[[RESULT_DECL:.*]]:2 = hlfir.declare %[[RESULT]] typeparams %c1{{.*}} {uniq_name = "_QFf_int_to_charEf_int_to_char"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)
! CHECK: %[[INT_I:.*]] = fir.alloca i32
! CHECK: fir.store %[[ARG0]] to %[[INT_I]] : !fir.ref<i32>
-! CHECK: %[[ARG0_2:.*]] = fir.load %[[INT_I]] : !fir.ref<i32>
+! CHECK: %[[INT_I_DECL:.*]]:2 = hlfir.declare %[[INT_I]] dummy_scope %{{.*}} arg 1 {fortran_attrs = #fir.var_attrs<value>, uniq_name = "_QFf_int_to_charEi"} : (!fir.ref<i32>, !fir.dscope) -> (!fir.ref<i32>, !fir.ref<i32>)
+! CHECK: %[[ARG0_2:.*]] = fir.load %[[INT_I_DECL]]#0 : !fir.ref<i32>
! CHECK: %[[ARG0_I64:.*]] = fir.convert %[[ARG0_2]] : (i32) -> i64
! CHECK: %[[ARG0_I8:.*]] = fir.convert %[[ARG0_I64]] : (i64) -> i8
! CHECK: %[[UNDEF:.*]] = fir.undefined !fir.char<1>
! CHECK: %[[CHAR_RES:.*]] = fir.insert_value %[[UNDEF]], %[[ARG0_I8]], [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
-! CHECK: fir.store %[[CHAR_RES]] to %[[CHARBOX]] : !fir.ref<!fir.char<1>>
-! CHECK: %[[LOAD_CHARBOX:.*]] = fir.load %[[CHARBOX]] : !fir.ref<!fir.char<1>>
-! CHECK: fir.store %[[LOAD_CHARBOX]] to %[[RESULT]] : !fir.ref<!fir.char<1>>
-! CHECK: %[[LOAD_RES:.*]] = fir.load %[[RESULT]] : !fir.ref<!fir.char<1>>
+! CHECK: fir.store %[[CHAR_RES]] to %[[TEMP]] : !fir.ref<!fir.char<1>>
+! CHECK: %[[EXPR:.*]] = hlfir.as_expr %[[TEMP]] move %false : (!fir.ref<!fir.char<1>>, i1) -> !hlfir.expr<!fir.char<1>>
+! CHECK: hlfir.assign %[[EXPR]] to %[[RESULT_DECL]]#0 : !hlfir.expr<!fir.char<1>>, !fir.ref<!fir.char<1>>
+! CHECK: hlfir.destroy %[[EXPR]] : !hlfir.expr<!fir.char<1>>
+! CHECK: %[[LOAD_RES:.*]] = fir.load %[[RESULT_DECL]]#0 : !fir.ref<!fir.char<1>>
! CHECK: return %[[LOAD_RES]] : !fir.char<1>
diff --git a/flang/test/Lower/character-compare.f90 b/flang/test/Lower/character-compare.f90
index a7893f18f4a54..dd5836b4ad446 100644
--- a/flang/test/Lower/character-compare.f90
+++ b/flang/test/Lower/character-compare.f90
@@ -1,10 +1,9 @@
-! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
+! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
! CHECK-LABEL: compare
subroutine compare(x, c1, c2)
character(len=4) c1, c2
logical x
- ! CHECK: %[[RES:.*]] = fir.call @_FortranACharacterCompareScalar1
- ! CHECK: cmpi slt, %[[RES]],
+ ! CHECK: hlfir.cmpchar slt
x = c1 < c2
end subroutine compare
More information about the flang-commits
mailing list