[PATCH] D113154: [OpenMP] Add parsing/sema/serialization for 'bind' clause
Mike Rice via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 4 08:35:26 PDT 2021
mikerice added inline comments.
================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:4706-4713
+ // OpenMP 5.1 [2.11.7, loop Construct, Restrictions]
+ // If a loop construct is not nested inside another OpenMP construct and it
+ // appears in a procedure, the bind clause must be present.
+ if (CurrentRegion == OMPD_loop && ParentRegion == OMPD_unknown &&
+ BindKind == OMPC_BIND_unknown) {
+ SemaRef.Diag(StartLoc, diag::err_omp_loop_directive_without_bind);
+ return true;
----------------
ABataev wrote:
> Do we allow something like this:
> ```
> void foo() {
> #pragma omp loop // no bind
> ...
> }
> volid bar() {
> #pragma omp parallel
> foo();
> }
> ```
> ?
I thought this is not allowed and a bind clause should be used. But there appears to be some room for allowing it. The spec also says:
> If the bind clause is not present on the construct and the loop construct is closely nested inside a teams or parallel construct, the binding region is the corresponding teams or parallel region. **If none of those conditions hold, the binding region is not defined.**
> If the binding region is not defined, then the binding thread set is the encountering thread.
Should I remove this check or leave it? It's not clear to me what the intentions are here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113154/new/
https://reviews.llvm.org/D113154
More information about the llvm-commits
mailing list