Skip to content

[Flang] [OpenMP] Allow any type as argument to the FlushOp #143844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions flang/test/Lower/OpenMP/flush02.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
! This test checks lowering of OpenMP Flush Directive.

!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s

module flush02_mod
type t1
integer(kind=4) :: x = 4
end type t1

type :: t2
type(t1) :: y = t1(2)
end type t2


contains

subroutine sub01(pt)
class(t1), intent(inout) :: pt
type(t2) :: dt
integer, allocatable :: a(:)
integer, pointer :: b(:)

! CHECK: omp.flush({{.*}} : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>)
! CHECK: omp.flush({{.*}} : !fir.ref<f32>)
! CHECK: omp.flush({{.*}} : !fir.ref<!fir.type<_QMflush02_modTt2{y:!fir.type<_QMflush02_modTt1{x:i32}>}>>)
! CHECK: omp.flush({{.*}} : !fir.class<!fir.type<_QMflush02_modTt1{x:i32}>>)
!$omp flush(a)
!$omp flush(p)
!$omp flush(dt)
!$omp flush(pt)
end subroutine
end module flush02_mod
2 changes: 1 addition & 1 deletion mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ def FlushOp : OpenMP_Op<"flush", clauses = [
specified or implied.
}] # clausesDescription;

let arguments = !con((ins Variadic<OpenMP_PointerLikeType>:$varList),
let arguments = !con((ins Variadic<AnyType>:$varList),
clausesArgs);

// Override inherited assembly format to include `varList`.
Expand Down