[flang-commits] [flang] c4d288d - [flang][OpenMP] Don't check unlabelled `cycle` branching for target loops (#111656)

via flang-commits flang-commits at lists.llvm.org
Wed Oct 9 07:47:12 PDT 2024


Author: Kareem Ergawy
Date: 2024-10-09T16:47:06+02:00
New Revision: c4d288d9e21f44bc4a0f26e7655eba851a9b6225

URL: https://github.com/llvm/llvm-project/commit/c4d288d9e21f44bc4a0f26e7655eba851a9b6225
DIFF: https://github.com/llvm/llvm-project/commit/c4d288d9e21f44bc4a0f26e7655eba851a9b6225.diff

LOG: [flang][OpenMP] Don't check unlabelled `cycle` branching for target loops (#111656)

Properly handles `cycle` branching inside target distribute loops.

Added: 
    

Modified: 
    flang/lib/Semantics/check-directive-structure.h
    flang/test/Semantics/OpenMP/do05-positivecase.f90

Removed: 
    


################################################################################
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