-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[flang][OpenMP] Fix parsing of ASSUME directive #155257
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,141 @@ | ||
| ! RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-unparse-no-sema %s 2>&1 | FileCheck %s | ||
| ! RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-dump-parse-tree-no-sema %s 2>&1 | FileCheck %s --check-prefix="PARSE-TREE" | ||
| !RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-unparse-no-sema %s | FileCheck --check-prefix="UNPARSE" %s | ||
| !RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-dump-parse-tree-no-sema %s | FileCheck --check-prefix="PARSE-TREE" %s | ||
|
|
||
| subroutine sub1 | ||
| integer :: r | ||
| !CHECK: !$OMP ASSUME NO_OPENMP | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: Verbatim | ||
| !PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmp | ||
| !$omp assume no_openmp | ||
| !CHECK: !$OMP ASSUME NO_PARALLELISM | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: Verbatim | ||
| !PARSE-TREE: OmpClauseList -> OmpClause -> NoParallelism | ||
| !$omp end assume | ||
|
|
||
| !$omp assume no_parallelism | ||
| !CHECK: !$OMP ASSUME NO_OPENMP_ROUTINES | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: Verbatim | ||
| !PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmpRoutines | ||
| !$omp end assume | ||
|
|
||
| !$omp assume no_openmp_routines | ||
| !CHECK: !$OMP ASSUME ABSENT(ALLOCATE), CONTAINS(WORKSHARE,TASK) | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: Verbatim | ||
| !PARSE-TREE: OmpClauseList -> OmpClause -> Absent -> OmpAbsentClause -> llvm::omp::Directive = allocate | ||
| !PARSE-TREE: OmpClause -> Contains -> OmpContainsClause -> llvm::omp::Directive = workshare | ||
| !PARSE-TREE: llvm::omp::Directive = task | ||
| !$omp assume absent(allocate), contains(workshare, task) | ||
| !CHECK: !$OMP ASSUME HOLDS(1==1) | ||
| !$omp end assume | ||
|
|
||
| !$omp assume absent(allocate), contains(workshare, task) | ||
| !$omp end assume | ||
|
|
||
| !$omp assume holds(1.eq.1) | ||
| !$omp end assume | ||
| print *, r | ||
| end subroutine sub1 | ||
|
|
||
| !UNPARSE: SUBROUTINE sub1 | ||
| !UNPARSE: INTEGER r | ||
| !UNPARSE: !$OMP ASSUME NO_OPENMP | ||
| !UNPARSE: !$OMP END ASSUME | ||
| !UNPARSE: !$OMP ASSUME NO_PARALLELISM | ||
| !UNPARSE: !$OMP END ASSUME | ||
| !UNPARSE: !$OMP ASSUME NO_OPENMP_ROUTINES | ||
| !UNPARSE: !$OMP END ASSUME | ||
| !UNPARSE: !$OMP ASSUME ABSENT(ALLOCATE) CONTAINS(WORKSHARE,TASK) | ||
| !UNPARSE: !$OMP END ASSUME | ||
| !UNPARSE: !$OMP ASSUME HOLDS(1==1) | ||
| !UNPARSE: !$OMP END ASSUME | ||
| !UNPARSE: PRINT *, r | ||
| !UNPARSE: END SUBROUTINE sub1 | ||
|
|
||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: | OmpBeginDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> OmpClause -> NoOpenmp | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: | Block | ||
| !PARSE-TREE: | OmpEndDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: | OmpBeginDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> OmpClause -> NoParallelism | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: | Block | ||
| !PARSE-TREE: | OmpEndDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: | OmpBeginDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> OmpClause -> NoOpenmpRoutines | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: | Block | ||
| !PARSE-TREE: | OmpEndDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: | OmpBeginDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> OmpClause -> Absent -> OmpAbsentClause -> llvm::omp::Directive = allocate | ||
| !PARSE-TREE: | | OmpClause -> Contains -> OmpContainsClause -> llvm::omp::Directive = workshare | ||
| !PARSE-TREE: | | llvm::omp::Directive = task | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: | Block | ||
| !PARSE-TREE: | OmpEndDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: | OmpBeginDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> OmpClause -> Holds -> OmpHoldsClause -> Expr -> EQ | ||
| !PARSE-TREE: | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' | ||
| !PARSE-TREE: | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: | Block | ||
| !PARSE-TREE: | OmpEndDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> | ||
| !PARSE-TREE: | | Flags = None | ||
|
|
||
|
|
||
| subroutine sub2 | ||
| integer :: r | ||
| integer :: v | ||
| !CHECK !$OMP ASSUME NO_OPENMP | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: OmpAssumeDirective | ||
| !PARSE-TREE: Verbatim | ||
| !PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmp | ||
| !PARSE-TREE: Block | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt | ||
| !PARSE-TREE: Expr -> Add | ||
| !PARSE-TREE: OmpEndAssumeDirective | ||
| v = 87 | ||
| !$omp assume no_openmp | ||
| r = r + 1 | ||
| !CHECK !$OMP END ASSUME | ||
| !$omp end assume | ||
| end subroutine sub2 | ||
|
|
||
|
|
||
| !UNPARSE: SUBROUTINE sub2 | ||
| !UNPARSE: INTEGER r | ||
| !UNPARSE: INTEGER v | ||
| !UNPARSE: v = 87 | ||
| !UNPARSE: !$OMP ASSUME NO_OPENMP | ||
| !UNPARSE: r = r+1 | ||
| !UNPARSE: !$OMP END ASSUME | ||
| !UNPARSE: END SUBROUTINE sub2 | ||
|
|
||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt | ||
| !PARSE-TREE: | Variable -> Designator -> DataRef -> Name = 'v' | ||
| !PARSE-TREE: | Expr -> LiteralConstant -> IntLiteralConstant = '87' | ||
| !PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPAssumeConstruct | ||
| !PARSE-TREE: | OmpBeginDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> OmpClause -> NoOpenmp | ||
| !PARSE-TREE: | | Flags = None | ||
| !PARSE-TREE: | Block | ||
| !PARSE-TREE: | | ExecutionPartConstruct -> ExecutableConstruct -> ActionStmt -> AssignmentStmt | ||
| !PARSE-TREE: | | | Variable -> Designator -> DataRef -> Name = 'r' | ||
| !PARSE-TREE: | | | Expr -> Add | ||
| !PARSE-TREE: | | | | Expr -> Designator -> DataRef -> Name = 'r' | ||
| !PARSE-TREE: | | | | Expr -> LiteralConstant -> IntLiteralConstant = '1' | ||
| !PARSE-TREE: | OmpEndDirective | ||
| !PARSE-TREE: | | OmpDirectiveName -> llvm::omp::Directive = assume | ||
| !PARSE-TREE: | | OmpClauseList -> | ||
| !PARSE-TREE: | | Flags = None | ||
|
|
||
| program p | ||
| !CHECK !$OMP ASSUMES NO_OPENMP | ||
| !PARSE-TREE: SpecificationPart | ||
| !PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPDeclarativeAssumes | ||
| !PARSE-TREE: Verbatim | ||
| !PARSE-TREE: OmpClauseList -> OmpClause -> NoOpenmp | ||
| !$omp assumes no_openmp | ||
| end program p | ||
|
|
||
|
|
||
| !UNPARSE: PROGRAM p | ||
| !UNPARSE: !$OMP ASSUMES NO_OPENMP | ||
| !UNPARSE: END PROGRAM p | ||
|
|
||
| !PARSE-TREE: OpenMPDeclarativeConstruct -> OpenMPDeclarativeAssumes | ||
| !PARSE-TREE: | Verbatim | ||
| !PARSE-TREE: | OmpClauseList -> OmpClause -> NoOpenmp | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this now testing slightly different code? Perhaps these could be adapted so that each example takes a different allowed form (e.g. loosely structured, strictly structured, ...)?
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.
The original code in the testcase was not legal. It had a loosely structured block (i.e. empty list of statements) without the end-directive.
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.
Added strictly structured blocks without end-directive in a couple of places.