================
@@ -0,0 +1,156 @@
+! Test remapping of component references in data clauses.
+! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s
+
+module mhdata_types
+ type t_scalar
+ integer :: x
+ real :: y
+ end type
+ type t_array
+ integer :: x
+ real :: y(10)
+ end type
+ type t_character
+ integer :: x
+ character(5) :: y
+ end type
+ type t_pointer
+ integer :: x
+ real, pointer :: y(:)
+ end type
+ type t_nested
+ type(t_array) :: comp(100)
+ end type
+end module
+
+subroutine test_scalar_comp(obj)
+ use mhdata_types, only : t_scalar
+ type(t_scalar) :: obj
+ !$acc host_data use_device(obj%y)
+ call foo_scalar(obj%y)
+ !$acc end host_data
+end subroutine
+
+subroutine test_array_comp(obj)
+ use mhdata_types, only : t_array
+ type(t_array) :: obj
+ !$acc host_data use_device(obj%y)
+ call foo_array(obj%y)
+ !$acc end host_data
+end subroutine
+
+subroutine test_character_comp(obj)
+ use mhdata_types, only : t_character
+ type(t_character) :: obj
+ !$acc host_data use_device(obj%y)
+ call foo_character(obj%y)
+ !$acc end host_data
+end subroutine
+
+subroutine test_pointer_comp(obj)
+ use mhdata_types, only : t_pointer
+ type(t_pointer) :: obj
+ interface
+ subroutine foo_pointer(x)
+ real, pointer :: x(:)
+ end subroutine
+ end interface
+ !$acc host_data use_device(obj%y)
+ call foo_pointer(obj%y)
+ !$acc end host_data
+end subroutine
+
+subroutine test_nested_comp(obj)
+ use mhdata_types, only : t_nested
+ type(t_nested) :: obj(:)
+ !$acc host_data use_device(obj(10)%comp(2)%y(4))
+ call foo_nested(obj(10)%comp(2)%y(4))
+ !$acc end host_data
+end subroutine
+
+! CHECK-LABEL: func.func @_QPtest_scalar_comp(
+! CHECK-SAME: %[[ARG0:.*]]:
!fir.ref<!fir.type<_QMmhdata_typesTt_scalar{x:i32,y:f32}>> {fir.bindc_name =
"obj"}) {
+! CHECK: %[[DUMMY_SCOPE_0:.*]] = fir.dummy_scope : !fir.dscope
+! CHECK: %[[DECLARE_0:.*]]:2 = hlfir.declare %[[ARG0]] dummy_scope
%[[DUMMY_SCOPE_0]] arg 1 {uniq_name = "_QFtest_scalar_compEobj"} :
(!fir.ref<!fir.type<_QMmhdata_typesTt_scalar{x:i32,y:f32}>>, !fir.dscope) ->
(!fir.ref<!fir.type<_QMmhdata_typesTt_scalar{x:i32,y:f32}>>,
!fir.ref<!fir.type<_QMmhdata_typesTt_scalar{x:i32,y:f32}>>)
+! CHECK: %[[DESIGNATE_0:.*]] = hlfir.designate %[[DECLARE_0]]#0{"y"}
: (!fir.ref<!fir.type<_QMmhdata_typesTt_scalar{x:i32,y:f32}>>) ->
!fir.ref<f32>
+! CHECK: %[[USE_DEVICE_0:.*]] = acc.use_device
varPtr(%[[DESIGNATE_0]] : !fir.ref<f32>) -> !fir.ref<f32> {name =
"obj%[[VAL_0:.*]]"}
----------------
jeanPerier wrote:
Thanks, it is static. The scripts to make lit test is confused by the "%" in
the string and thinks it is for an SSA value.
I updated the test.
https://github.com/llvm/llvm-project/pull/171501
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits