mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 23:06:34 +00:00

Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested.
30 lines
1.3 KiB
Fortran
30 lines
1.3 KiB
Fortran
! RUN: bbc -emit-fir -hlfir=false %s -o - | FileCheck %s
|
|
|
|
! CHECK-LABEL: func @_QPchar_return_callee(
|
|
! CHECK-SAME: %{{.*}}: !fir.ref<!fir.char<1,10>>{{.*}}, %{{.*}}: index{{.*}}, %{{.*}}: !fir.ref<i32>{{.*}}) -> !fir.boxchar<1> {
|
|
function char_return_callee(i)
|
|
character(10) :: char_return_callee
|
|
integer :: i
|
|
end function
|
|
|
|
! CHECK-LABEL: @_QPtest_char_return_caller()
|
|
subroutine test_char_return_caller
|
|
character(10) :: char_return_caller
|
|
! CHECK: fir.call @_QPchar_return_caller({{.*}}) {{.*}}: (!fir.ref<!fir.char<1,10>>, index, !fir.ref<i32>) -> !fir.boxchar<1>
|
|
print *, char_return_caller(5)
|
|
end subroutine
|
|
|
|
! CHECK-LABEL: func @_QPtest_passing_char_array()
|
|
subroutine test_passing_char_array
|
|
character(len=3) :: x(4)
|
|
call sub_taking_a_char_array(x)
|
|
! CHECK-DAG: %[[xarray:.*]] = fir.alloca !fir.array<4x!fir.char<1,3>>
|
|
! CHECK-DAG: %[[c3:.*]] = arith.constant 3 : index
|
|
! CHECK-DAG: %[[xbuff:.*]] = fir.convert %[[xarray]] : (!fir.ref<!fir.array<4x!fir.char<1,3>>>) -> !fir.ref<!fir.char<1,?>>
|
|
! CHECK: %[[boxchar:.*]] = fir.emboxchar %[[xbuff]], %[[c3]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
|
|
! CHECK: fir.call @_QPsub_taking_a_char_array(%[[boxchar]]) {{.*}}: (!fir.boxchar<1>) -> ()
|
|
end subroutine
|
|
|
|
! TODO more implicit interface cases with/without explicit interface
|
|
|