forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] lower assumed type actual arguments in call statements
- Loading branch information
Showing
2 changed files
with
57 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
! Test lowering of call statements to HLFIR with assumed types | ||
! arguments. These are a bit special because semantics do not represent | ||
! assumed types actual arguments with an evaluate::Expr like for usual | ||
! arguments. | ||
! RUN: bbc -emit-hlfir --polymorphic-type -o - %s | FileCheck %s | ||
|
||
subroutine test1(x) | ||
type(*) :: x | ||
interface | ||
subroutine fun1(x) | ||
type(*) :: x | ||
end subroutine | ||
end interface | ||
call fun1(x) | ||
end subroutine | ||
! CHECK-LABEL: func.func @_QPtest1( | ||
! CHECK-SAME: %[[ARG0:.*]]: !fir.ref<none> {fir.bindc_name = "x"}) { | ||
! CHECK: %[[VAL_0:.*]]:2 = hlfir.declare %[[ARG0]] {uniq_name = "_QFtest1Ex"} : (!fir.ref<none>) -> (!fir.ref<none>, !fir.ref<none>) | ||
! CHECK: fir.call @_QPfun1(%[[VAL_0]]#1) fastmath<contract> : (!fir.ref<none>) -> () | ||
! CHECK: return | ||
! CHECK: } | ||
|
||
subroutine test2(x) | ||
type(*) :: x | ||
interface | ||
subroutine fun2(x) | ||
type(*) :: x(:) | ||
end subroutine | ||
end interface | ||
call fun2(x) | ||
end subroutine | ||
! CHECK-LABEL: func.func @_QPtest2( | ||
! CHECK-SAME: %[[ARG0:.*]]: !fir.ref<none> {fir.bindc_name = "x"}) { | ||
! CHECK: %[[VAL_0:.*]]:2 = hlfir.declare %[[ARG0]] {uniq_name = "_QFtest2Ex"} : (!fir.ref<none>) -> (!fir.ref<none>, !fir.ref<none>) | ||
! CHECK: %[[VAL_1:.*]] = fir.embox %[[VAL_0]]#0 : (!fir.ref<none>) -> !fir.box<none> | ||
! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_1]] : (!fir.box<none>) -> !fir.box<!fir.array<?xnone>> | ||
! CHECK: fir.call @_QPfun2(%[[VAL_2]]) fastmath<contract> : (!fir.box<!fir.array<?xnone>>) -> () | ||
! CHECK: return | ||
! CHECK: } |