Valentin Clement e28e1b4b6d
[flang][NFC] Add call lowering tests
This patch adds various lowering test
for calls.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122306

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Mats Petersson <mats.petersson@arm.com>
2022-03-23 15:27:17 +01:00

21 lines
709 B
Fortran

! 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 %s -o - | FileCheck %s
! CHECK-LABEL: func @_QPtest_nested_calls
subroutine test_nested_calls()
interface
subroutine foo(i)
integer :: i
end subroutine
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>) -> ()
call foo(bar())
end subroutine