From 4268360003e2dc6721469aa5ccab7efbb29dcbfd Mon Sep 17 00:00:00 2001 From: Thirumalai Shaktivel <74826228+Thirumalai-Shaktivel@users.noreply.github.com> Date: Fri, 13 Jun 2025 09:35:48 +0530 Subject: [PATCH] [Flang] [OpenMP] Allow any type as argument to the FlushOp (#143844) Fixes: #143842 --- flang/test/Lower/OpenMP/flush02.f90 | 32 +++++++++++++++++++ mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 flang/test/Lower/OpenMP/flush02.f90 diff --git a/flang/test/Lower/OpenMP/flush02.f90 b/flang/test/Lower/OpenMP/flush02.f90 new file mode 100644 index 000000000000..b372e700e1a1 --- /dev/null +++ b/flang/test/Lower/OpenMP/flush02.f90 @@ -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>>>) + ! CHECK: omp.flush({{.*}} : !fir.ref) + ! CHECK: omp.flush({{.*}} : !fir.ref}>>) + ! CHECK: omp.flush({{.*}} : !fir.class>) + !$omp flush(a) + !$omp flush(p) + !$omp flush(dt) + !$omp flush(pt) + end subroutine +end module flush02_mod diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td index 036c6a6e350a..ac80926053a2 100644 --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -889,7 +889,7 @@ def FlushOp : OpenMP_Op<"flush", clauses = [ specified or implied. }] # clausesDescription; - let arguments = !con((ins Variadic:$varList), + let arguments = !con((ins Variadic:$varList), clausesArgs); // Override inherited assembly format to include `varList`.