Skip to content

Commit c4d288d

Browse files
authored
[flang][OpenMP] Don't check unlabelled cycle branching for target loops (#111656)
Properly handles `cycle` branching inside target distribute loops.
1 parent 6654578 commit c4d288d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

flang/lib/Semantics/check-directive-structure.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ template <typename D> class NoBranchingEnforce {
7474
case llvm::omp::Directive::OMPD_distribute_parallel_for:
7575
case llvm::omp::Directive::OMPD_distribute_simd:
7676
case llvm::omp::Directive::OMPD_distribute_parallel_for_simd:
77+
case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do:
78+
case llvm::omp::Directive::
79+
OMPD_target_teams_distribute_parallel_do_simd:
7780
return;
7881
default:
7982
break;

flang/test/Semantics/OpenMP/do05-positivecase.f90

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,19 @@ program omp_do
4242
end do
4343
!$omp end parallel
4444

45+
!$omp target teams distribute parallel do
46+
!DEF:/omp_do/OtherConstruct4/i (OmpPrivate ,OmpPreDetermined) HostAssoc INTEGER(4)
47+
do i=1,100
48+
!REF:/omp_do/OtherConstruct4/i
49+
if(i<10) cycle
50+
end do
51+
!$omp end target teams distribute parallel do
52+
53+
!$omp target teams distribute parallel do simd
54+
!DEF:/omp_do/OtherConstruct5/i (OmpLinear,OmpPreDetermined) HostAssoc INTEGER(4)
55+
do i=1,100
56+
!REF:/omp_do/OtherConstruct5/i
57+
if(i<10) cycle
58+
end do
59+
!$omp end target teams distribute parallel do simd
4560
end program omp_do

0 commit comments

Comments
 (0)