[PATCH] D92735: [Flang] [OpenMP] Add semantic checks for invalid branch into/from OpenMP constructs
Kiran Chandramohan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 21 09:46:07 PST 2020
kiranchandramohan added a comment.
> @kiranchandramohan We can make use of labelEnforce class to identify the control flow escaping the construct . But it would not be useful to identify the control flow entering the OpenMP constructs and also it does not identify the transfer of control from one OpenMP construct to another such as this.
> !$omp parallel
> goto 10
> a = a + b
> !$omp single
> 10 call sb()
> !$omp end single
> !$omp end parallel
Not clear what the issue is here. Is it that it will be inefficient to call enforce for each nested construct?
>> Function CheckBranchesIntoDoBody (https://github.com/llvm/llvm-project/blob/a2f922140f5380571fb74179f2bf622b3b925697/flang/lib/Semantics/resolve-labels.cpp#L845) in resolve-labels.cpp checks for branches into the body of a loop. Can this code be reused?
> Since the function CheckBranchesIntoDoBody does not follow the OpenMP constructs , I guess it would not be much useful in this case . Please suggest.
The CheckBranchesIntoDoBody takes in a list of branches, labels, location of bodies of constructs. This seemed to be a generic function which can be moved to Semantics/tools.cpp and reused.
void CheckBranchesIntoDoBody(const SourceStmtList &branches,
const TargetStmtMap &labels, const IndexList &loopBodies,
SemanticsContext &context)
The reason I asked to look at reusing existing code is because labelEnforce class seems to be checking for labels arising for more statements (see below). It was not clear to me whether you were missing some or whether some are not allowed in OpenMP.
void LabelEnforce::Post(const parser::GotoStmt &gotoStmt) {
void LabelEnforce::Post(const parser::ComputedGotoStmt &computedGotoStmt) {
void LabelEnforce::Post(const parser::ArithmeticIfStmt &arithmeticIfStmt) {
void LabelEnforce::Post(const parser::AssignStmt &assignStmt) {
void LabelEnforce::Post(const parser::AssignedGotoStmt &assignedGotoStmt) {
void LabelEnforce::Post(const parser::AltReturnSpec &altReturnSpec) {
void LabelEnforce::Post(const parser::ErrLabel &errLabel) {
void LabelEnforce::Post(const parser::EndLabel &endLabel) {
void LabelEnforce::Post(const parser::EorLabel &eorLabel) {
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92735/new/
https://reviews.llvm.org/D92735
More information about the llvm-commits
mailing list