[flang-commits] [flang] [flang][OpenMP] Don't check unlabelled `cycle` branching for target loops (PR #111656)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Wed Oct 9 03:51:09 PDT 2024
https://github.com/ergawy updated https://github.com/llvm/llvm-project/pull/111656
>From bd8d6234ea7589eaab42b443f2fd6fd4f5ec33a0 Mon Sep 17 00:00:00 2001
From: ergawy <kareem.ergawy at amd.com>
Date: Wed, 9 Oct 2024 04:58:11 -0500
Subject: [PATCH] [flang][OpenMP] Don't check unlabelled `cycle` branching for
target loops
Properly handles `cycle` branching inside target distribute loops.
---
flang/lib/Semantics/check-directive-structure.h | 3 +++
flang/test/Semantics/OpenMP/do05-positivecase.f90 | 15 +++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/flang/lib/Semantics/check-directive-structure.h b/flang/lib/Semantics/check-directive-structure.h
index a1aff52f3a6843..2a9cb785a882f8 100644
--- a/flang/lib/Semantics/check-directive-structure.h
+++ b/flang/lib/Semantics/check-directive-structure.h
@@ -74,6 +74,9 @@ template <typename D> class NoBranchingEnforce {
case llvm::omp::Directive::OMPD_distribute_parallel_for:
case llvm::omp::Directive::OMPD_distribute_simd:
case llvm::omp::Directive::OMPD_distribute_parallel_for_simd:
+ case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do:
+ case llvm::omp::Directive::
+ OMPD_target_teams_distribute_parallel_do_simd:
return;
default:
break;
diff --git a/flang/test/Semantics/OpenMP/do05-positivecase.f90 b/flang/test/Semantics/OpenMP/do05-positivecase.f90
index 3b512a5b4f25eb..5e1b1b86f72f61 100644
--- a/flang/test/Semantics/OpenMP/do05-positivecase.f90
+++ b/flang/test/Semantics/OpenMP/do05-positivecase.f90
@@ -42,4 +42,19 @@ program omp_do
end do
!$omp end parallel
+ !$omp target teams distribute parallel do
+ !DEF:/omp_do/OtherConstruct4/i (OmpPrivate ,OmpPreDetermined) HostAssoc INTEGER(4)
+ do i=1,100
+ !REF:/omp_do/OtherConstruct4/i
+ if(i<10) cycle
+ end do
+ !$omp end target teams distribute parallel do
+
+ !$omp target teams distribute parallel do simd
+ !DEF:/omp_do/OtherConstruct5/i (OmpLinear,OmpPreDetermined) HostAssoc INTEGER(4)
+ do i=1,100
+ !REF:/omp_do/OtherConstruct5/i
+ if(i<10) cycle
+ end do
+ !$omp end target teams distribute parallel do simd
end program omp_do
More information about the flang-commits
mailing list