-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[flang][OpenMP] Don't check unlabelled cycle
branching for target loops
#111656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-flang-openmp @llvm/pr-subscribers-flang-semantics Author: Kareem Ergawy (ergawy) ChangesProperly handles Full diff: https://github.com/llvm/llvm-project/pull/111656.diff 2 Files Affected:
diff --git a/flang/lib/Semantics/check-directive-structure.h b/flang/lib/Semantics/check-directive-structure.h
index a1aff52f3a6843..ee360161d351e6 100644
--- a/flang/lib/Semantics/check-directive-structure.h
+++ b/flang/lib/Semantics/check-directive-structure.h
@@ -74,6 +74,8 @@ 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
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
…oops Properly handles `cycle` branching inside target distribute loops.
84a85e8
to
bd8d623
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray formatting change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, our formatting rules demand this.
Properly handles
cycle
branching inside target distribute loops.