Files
TheRock/compiler/amd-llvm/flang/test/Lower/OpenMP/copyin-derived-allocatable-comp.f90
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

89 lines
2.6 KiB
Fortran

! Test lowering of COPYIN clause for derived types with allocatable components.
! Threadprivate copies may have uninitialized allocatable component descriptors
! (zero-filled by the OpenMP runtime). For non-master threads, use
! temporary_lhs semantics so that AssignTemporary initializes descriptors
! before performing the deep copy. The master thread is skipped via a runtime
! address comparison (lhs == rhs means same threadprivate storage).
! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck %s
! RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
! CHECK-LABEL: func.func @_QPcopyin_derived_alloc_comp
subroutine copyin_derived_alloc_comp()
type inner
integer, allocatable :: a(:)
end type inner
type outer
type(inner) :: s
end type outer
type(outer), save :: x(2)
!$omp threadprivate(x)
allocate(x(1)%s%a(3))
x(1)%s%a = 42
! CHECK: omp.parallel {
! CHECK: omp.threadprivate
! CHECK: hlfir.declare
! CHECK: fir.convert {{.*}} -> index
! CHECK: fir.convert {{.*}} -> index
! CHECK: arith.cmpi eq, {{.*}} : index
! CHECK: fir.if
! CHECK: } else {
! CHECK: hlfir.assign {{.*}} temporary_lhs
! CHECK: }
! CHECK: omp.barrier
!$omp parallel copyin(x)
call sub(x(1)%s%a)
!$omp end parallel
deallocate(x(1)%s%a)
end subroutine
! CHECK-LABEL: func.func @_QPcopyin_scalar_derived_alloc_comp
subroutine copyin_scalar_derived_alloc_comp()
type dt
integer, allocatable :: a(:)
end type dt
type(dt), save :: y
!$omp threadprivate(y)
allocate(y%a(5))
y%a = 10
! CHECK: omp.parallel {
! CHECK: omp.threadprivate
! CHECK: hlfir.declare
! CHECK: fir.convert {{.*}} -> index
! CHECK: fir.convert {{.*}} -> index
! CHECK: arith.cmpi eq, {{.*}} : index
! CHECK: fir.if
! CHECK: } else {
! CHECK: hlfir.assign {{.*}} temporary_lhs
! CHECK: }
! CHECK: omp.barrier
!$omp parallel copyin(y)
call sub(y%a)
!$omp end parallel
deallocate(y%a)
end subroutine
! Derived type WITHOUT allocatable components: plain assign, no address check.
! CHECK-LABEL: func.func @_QPcopyin_no_alloc_comp
subroutine copyin_no_alloc_comp()
type simple
integer :: val
end type simple
type(simple), save :: z
!$omp threadprivate(z)
! CHECK: omp.parallel {
! CHECK: omp.threadprivate
! CHECK: hlfir.declare
! CHECK-NOT: arith.cmpi
! CHECK: hlfir.assign
! CHECK-NOT: temporary_lhs
! CHECK: omp.barrier
!$omp parallel copyin(z)
call sub2(z%val)
!$omp end parallel
end subroutine