Skip to content

Commit 4268360

Browse files
[Flang] [OpenMP] Allow any type as argument to the FlushOp (#143844)
Fixes: #143842
1 parent 9992668 commit 4268360

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

flang/test/Lower/OpenMP/flush02.f90

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
! This test checks lowering of OpenMP Flush Directive.
2+
3+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
4+
5+
module flush02_mod
6+
type t1
7+
integer(kind=4) :: x = 4
8+
end type t1
9+
10+
type :: t2
11+
type(t1) :: y = t1(2)
12+
end type t2
13+
14+
15+
contains
16+
17+
subroutine sub01(pt)
18+
class(t1), intent(inout) :: pt
19+
type(t2) :: dt
20+
integer, allocatable :: a(:)
21+
integer, pointer :: b(:)
22+
23+
! CHECK: omp.flush({{.*}} : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>)
24+
! CHECK: omp.flush({{.*}} : !fir.ref<f32>)
25+
! CHECK: omp.flush({{.*}} : !fir.ref<!fir.type<_QMflush02_modTt2{y:!fir.type<_QMflush02_modTt1{x:i32}>}>>)
26+
! CHECK: omp.flush({{.*}} : !fir.class<!fir.type<_QMflush02_modTt1{x:i32}>>)
27+
!$omp flush(a)
28+
!$omp flush(p)
29+
!$omp flush(dt)
30+
!$omp flush(pt)
31+
end subroutine
32+
end module flush02_mod

mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ def FlushOp : OpenMP_Op<"flush", clauses = [
889889
specified or implied.
890890
}] # clausesDescription;
891891

892-
let arguments = !con((ins Variadic<OpenMP_PointerLikeType>:$varList),
892+
let arguments = !con((ins Variadic<AnyType>:$varList),
893893
clausesArgs);
894894

895895
// Override inherited assembly format to include `varList`.

0 commit comments

Comments
 (0)