Skip to content

Commit 9aebfde

Browse files
authored
[flang] Allow cycle in target teams distribute [simd] (#145462)
flang incorrectly issues a semantic erorr when a `cycle` statement is used inside a `target teams distribute [simd]` associated loop. This is not prevented by the spec, therefore this PR allows such construct.
1 parent 352baa3 commit 9aebfde

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ template <typename D> class NoBranchingEnforce {
7676
case llvm::omp::Directive::OMPD_distribute_parallel_for:
7777
case llvm::omp::Directive::OMPD_distribute_simd:
7878
case llvm::omp::Directive::OMPD_distribute_parallel_for_simd:
79+
case llvm::omp::Directive::OMPD_target_teams_distribute:
80+
case llvm::omp::Directive::OMPD_target_teams_distribute_simd:
7981
case llvm::omp::Directive::OMPD_target_teams_distribute_parallel_do:
8082
case llvm::omp::Directive::
8183
OMPD_target_teams_distribute_parallel_do_simd:

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,18 @@ program omp_do
5757
if(i<10) cycle
5858
end do
5959
!$omp end target teams distribute parallel do simd
60+
61+
!$omp target teams distribute
62+
!DEF: /omp_do/OtherConstruct6/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
63+
do i=1,100
64+
!REF: /omp_do/OtherConstruct6/i
65+
if(i < 5) cycle
66+
end do
67+
68+
!$omp target teams distribute simd
69+
!DEF: /omp_do/OtherConstruct7/i (OmpLinear, OmpPreDetermined) HostAssoc INTEGER(4)
70+
do i=1,100
71+
!REF: /omp_do/OtherConstruct7/i
72+
if(i < 5) cycle
73+
end do
6074
end program omp_do

0 commit comments

Comments
 (0)