[PATCH] D106165: [flang][OpenMP] Add semantic check for target nesting
Kiran Chandramohan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 14:49:13 PDT 2021
kiranchandramohan requested changes to this revision.
kiranchandramohan added a comment.
This revision now requires changes to proceed.
Have some suggestions.
================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:483
+ // 2.12.5 Target Construct Restriction
+ bool eligibleTarget{false};
+ llvm::omp::Directive directive;
----------------
The name of the variable does not match its intention. Like these are the ones that cause a warning if true, right?
================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:521
+ context_.Say(parser::FindSourceLocation(c),
+ "%s directive should not be nested inside TARGET region"_en_US,
+ parser::ToUpperCaseLetters(getDirectiveName(directive).str()));
----------------
Can the warning be changed to what the standard says, that the "behaviour is unspecified"?
================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:291
}
+ if (GetTARGETNest() > 0) {
+ CheckTARGETNest(x);
----------------
peixin wrote:
> clementval wrote:
> > It would be better to have a generic `IsNestedIn` function where you can pass the directive you want to check for. We don't want to have a counter for each construct.
> I am thinking about if we can replace this for loop search with the counter marked for `target` nesting since the for loop is executed for each openmp construct check, which is not efficient. With the design in https://reviews.llvm.org/D106335, I only need add one more element in the enum definition of `directiveNestType`. What do you think?
That sounds good to me.
I think ideally, you can do the following.
On visiting a target_data, target_update, target_enter_data or target_exit_data directive check if it is nested in a target region using GetDirectiveNest and report a warning if it is nested.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106165/new/
https://reviews.llvm.org/D106165
More information about the llvm-commits
mailing list