[PATCH] D99848: [OPENMP51]Initial support for nocontext clause
This revision was automatically updated to reflect the committed changes. jyu2 marked an inline comment as done and an inline comment as not done. Closed by commit rG7078ef472250: [OPENMP51]Initial support for nocontext clause. (authored by jyu2). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99848/new/ https://reviews.llvm.org/D99848 Files: clang/include/clang/AST/OpenMPClause.h clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/Sema/Sema.h clang/lib/AST/OpenMPClause.cpp clang/lib/AST/StmtProfile.cpp clang/lib/Basic/OpenMPKinds.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/Parse/ParseOpenMP.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/OpenMP/dispatch_ast_print.cpp clang/test/OpenMP/dispatch_messages.cpp clang/tools/libclang/CIndex.cpp flang/lib/Semantics/check-omp-structure.cpp llvm/include/llvm/Frontend/OpenMP/OMP.td Index: llvm/include/llvm/Frontend/OpenMP/OMP.td === --- llvm/include/llvm/Frontend/OpenMP/OMP.td +++ llvm/include/llvm/Frontend/OpenMP/OMP.td @@ -282,6 +282,10 @@ let clangClass = "OMPNovariantsClause"; let flangClass = "ScalarLogicalExpr"; } +def OMPC_Nocontext : Clause<"nocontext"> { + let clangClass = "OMPNocontextClause"; + let flangClass = "ScalarLogicalExpr"; +} def OMPC_Detach : Clause<"detach"> { let clangClass = "OMPDetachClause"; } @@ -1667,7 +1671,8 @@ VersionedClause, VersionedClause, VersionedClause, -VersionedClause +VersionedClause, +VersionedClause ]; } def OMP_Unknown : Directive<"unknown"> { Index: flang/lib/Semantics/check-omp-structure.cpp === --- flang/lib/Semantics/check-omp-structure.cpp +++ flang/lib/Semantics/check-omp-structure.cpp @@ -730,6 +730,7 @@ CHECK_SIMPLE_CLAUSE(Init, OMPC_init) CHECK_SIMPLE_CLAUSE(Use, OMPC_use) CHECK_SIMPLE_CLAUSE(Novariants, OMPC_novariants) +CHECK_SIMPLE_CLAUSE(Nocontext, OMPC_nocontext) CHECK_REQ_SCALAR_INT_CLAUSE(Allocator, OMPC_allocator) CHECK_REQ_SCALAR_INT_CLAUSE(Grainsize, OMPC_grainsize) Index: clang/tools/libclang/CIndex.cpp === --- clang/tools/libclang/CIndex.cpp +++ clang/tools/libclang/CIndex.cpp @@ -2295,6 +2295,10 @@ Visitor->AddStmt(C->getCondition()); } +void OMPClauseEnqueue::VisitOMPNocontextClause(const OMPNocontextClause *C) { + Visitor->AddStmt(C->getCondition()); +} + void OMPClauseEnqueue::VisitOMPUnifiedAddressClause( const OMPUnifiedAddressClause *) {} Index: clang/test/OpenMP/dispatch_messages.cpp === --- clang/test/OpenMP/dispatch_messages.cpp +++ clang/test/OpenMP/dispatch_messages.cpp @@ -46,6 +46,24 @@ // expected-error@+1 {{use of undeclared identifier 'x'}} #pragma omp dispatch novariants(x) disp_call(); + + // expected-error@+1 {{expected '(' after 'nocontext'}} + #pragma omp dispatch nocontext + disp_call(); + + // expected-error@+3 {{expected expression}} + // expected-error@+2 {{expected ')'}} + // expected-note@+1 {{to match this '('}} + #pragma omp dispatch nocontext ( + disp_call(); + + // expected-error@+1 {{cannot contain more than one 'nocontext' clause}} + #pragma omp dispatch nocontext(dnum> 4) nocontext(3) + disp_call(); + + // expected-error@+1 {{use of undeclared identifier 'x'}} + #pragma omp dispatch nocontext(x) + disp_call(); } void testit_two() { Index: clang/test/OpenMP/dispatch_ast_print.cpp === --- clang/test/OpenMP/dispatch_ast_print.cpp +++ clang/test/OpenMP/dispatch_ast_print.cpp @@ -51,22 +51,22 @@ void test_one() { int aaa, bbb, var; - //PRINT: #pragma omp dispatch depend(in : var) nowait novariants(aaa > 5) + //PRINT: #pragma omp dispatch depend(in : var) nowait novariants(aaa > 5) nocontext(bbb > 5) //DUMP: OMPDispatchDirective //DUMP: OMPDependClause //DUMP: OMPNowaitClause //DUMP: OMPNovariantsClause - #pragma omp dispatch depend(in:var) nowait novariants(aaa > 5) + #pragma omp dispatch depend(in:var) nowait novariants(aaa > 5) nocontext(bbb > 5) foo(aaa, ); int *dp = get_device_ptr(); int dev = get_device(); - //PRINT: #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) + //PRINT: #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) nocontext(dev > 5) //DUMP: OMPDispatchDirective //DUMP: OMPDeviceClause //DUMP: OMPIs_device_ptrClause //DUMP: OMPNovariantsClause - #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) + #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) nocontext(dev > 5) foo(aaa, dp); //PRINT: #pragma omp
[PATCH] D99848: [OPENMP51]Initial support for nocontext clause
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99848/new/ https://reviews.llvm.org/D99848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D99848: [OPENMP51]Initial support for nocontext clause
jyu2 added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:14908 llvm::MapVector Captures; + ValExpr = tryBuildCapture(*this, ValExpr, Captures).get(); HelperValStmt = buildPreInits(Context, Captures); ABataev wrote: > This must be fixed in a separate patch Okay I will submit separate patch for this. Thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99848/new/ https://reviews.llvm.org/D99848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D99848: [OPENMP51]Initial support for nocontext clause
jyu2 updated this revision to Diff 335272. jyu2 added a comment. Fix formatting problem and address Alexey's comment. Thanks Alexey for the review! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99848/new/ https://reviews.llvm.org/D99848 Files: clang/include/clang/AST/OpenMPClause.h clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/Sema/Sema.h clang/lib/AST/OpenMPClause.cpp clang/lib/AST/StmtProfile.cpp clang/lib/Basic/OpenMPKinds.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/Parse/ParseOpenMP.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/OpenMP/dispatch_ast_print.cpp clang/test/OpenMP/dispatch_messages.cpp clang/tools/libclang/CIndex.cpp flang/lib/Semantics/check-omp-structure.cpp llvm/include/llvm/Frontend/OpenMP/OMP.td Index: llvm/include/llvm/Frontend/OpenMP/OMP.td === --- llvm/include/llvm/Frontend/OpenMP/OMP.td +++ llvm/include/llvm/Frontend/OpenMP/OMP.td @@ -282,6 +282,10 @@ let clangClass = "OMPNovariantsClause"; let flangClass = "ScalarLogicalExpr"; } +def OMPC_Nocontext : Clause<"nocontext"> { + let clangClass = "OMPNocontextClause"; + let flangClass = "ScalarLogicalExpr"; +} def OMPC_Detach : Clause<"detach"> { let clangClass = "OMPDetachClause"; } @@ -1667,7 +1671,8 @@ VersionedClause, VersionedClause, VersionedClause, -VersionedClause +VersionedClause, +VersionedClause ]; } def OMP_Unknown : Directive<"unknown"> { Index: flang/lib/Semantics/check-omp-structure.cpp === --- flang/lib/Semantics/check-omp-structure.cpp +++ flang/lib/Semantics/check-omp-structure.cpp @@ -730,6 +730,7 @@ CHECK_SIMPLE_CLAUSE(Init, OMPC_init) CHECK_SIMPLE_CLAUSE(Use, OMPC_use) CHECK_SIMPLE_CLAUSE(Novariants, OMPC_novariants) +CHECK_SIMPLE_CLAUSE(Nocontext, OMPC_nocontext) CHECK_REQ_SCALAR_INT_CLAUSE(Allocator, OMPC_allocator) CHECK_REQ_SCALAR_INT_CLAUSE(Grainsize, OMPC_grainsize) Index: clang/tools/libclang/CIndex.cpp === --- clang/tools/libclang/CIndex.cpp +++ clang/tools/libclang/CIndex.cpp @@ -2295,6 +2295,10 @@ Visitor->AddStmt(C->getCondition()); } +void OMPClauseEnqueue::VisitOMPNocontextClause(const OMPNocontextClause *C) { + Visitor->AddStmt(C->getCondition()); +} + void OMPClauseEnqueue::VisitOMPUnifiedAddressClause( const OMPUnifiedAddressClause *) {} Index: clang/test/OpenMP/dispatch_messages.cpp === --- clang/test/OpenMP/dispatch_messages.cpp +++ clang/test/OpenMP/dispatch_messages.cpp @@ -46,6 +46,24 @@ // expected-error@+1 {{use of undeclared identifier 'x'}} #pragma omp dispatch novariants(x) disp_call(); + + // expected-error@+1 {{expected '(' after 'nocontext'}} + #pragma omp dispatch nocontext + disp_call(); + + // expected-error@+3 {{expected expression}} + // expected-error@+2 {{expected ')'}} + // expected-note@+1 {{to match this '('}} + #pragma omp dispatch nocontext ( + disp_call(); + + // expected-error@+1 {{cannot contain more than one 'nocontext' clause}} + #pragma omp dispatch nocontext(dnum> 4) nocontext(3) + disp_call(); + + // expected-error@+1 {{use of undeclared identifier 'x'}} + #pragma omp dispatch nocontext(x) + disp_call(); } void testit_two() { Index: clang/test/OpenMP/dispatch_ast_print.cpp === --- clang/test/OpenMP/dispatch_ast_print.cpp +++ clang/test/OpenMP/dispatch_ast_print.cpp @@ -51,22 +51,22 @@ void test_one() { int aaa, bbb, var; - //PRINT: #pragma omp dispatch depend(in : var) nowait novariants(aaa > 5) + //PRINT: #pragma omp dispatch depend(in : var) nowait novariants(aaa > 5) nocontext(bbb > 5) //DUMP: OMPDispatchDirective //DUMP: OMPDependClause //DUMP: OMPNowaitClause //DUMP: OMPNovariantsClause - #pragma omp dispatch depend(in:var) nowait novariants(aaa > 5) + #pragma omp dispatch depend(in:var) nowait novariants(aaa > 5) nocontext(bbb > 5) foo(aaa, ); int *dp = get_device_ptr(); int dev = get_device(); - //PRINT: #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) + //PRINT: #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) nocontext(dev > 5) //DUMP: OMPDispatchDirective //DUMP: OMPDeviceClause //DUMP: OMPIs_device_ptrClause //DUMP: OMPNovariantsClause - #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) + #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) nocontext(dev > 5) foo(aaa, dp); //PRINT: #pragma omp dispatch Index: clang/lib/Serialization/ASTWriter.cpp
[PATCH] D99848: [OPENMP51]Initial support for nocontext clause
ABataev added a comment. Formatting Comment at: clang/lib/Sema/SemaOpenMP.cpp:14908 llvm::MapVector Captures; + ValExpr = tryBuildCapture(*this, ValExpr, Captures).get(); HelperValStmt = buildPreInits(Context, Captures); This must be fixed in a separate patch Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99848/new/ https://reviews.llvm.org/D99848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D99848: [OPENMP51]Initial support for nocontext clause
jyu2 created this revision. jyu2 added reviewers: mikerice, ABataev, jdoerfert. Herald added subscribers: arphaman, guansong, yaxunl. Herald added a reviewer: sscalpone. jyu2 requested review of this revision. Herald added a subscriber: sstefan1. Herald added projects: clang, LLVM. Added basic parsing/sema/serialization support for the 'nocontext' clause. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D99848 Files: clang/include/clang/AST/OpenMPClause.h clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/Sema/Sema.h clang/lib/AST/OpenMPClause.cpp clang/lib/AST/StmtProfile.cpp clang/lib/Basic/OpenMPKinds.cpp clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/Parse/ParseOpenMP.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/Sema/TreeTransform.h clang/lib/Serialization/ASTReader.cpp clang/lib/Serialization/ASTWriter.cpp clang/test/OpenMP/dispatch_ast_print.cpp clang/test/OpenMP/dispatch_messages.cpp clang/tools/libclang/CIndex.cpp flang/lib/Semantics/check-omp-structure.cpp llvm/include/llvm/Frontend/OpenMP/OMP.td Index: llvm/include/llvm/Frontend/OpenMP/OMP.td === --- llvm/include/llvm/Frontend/OpenMP/OMP.td +++ llvm/include/llvm/Frontend/OpenMP/OMP.td @@ -282,6 +282,10 @@ let clangClass = "OMPNovariantsClause"; let flangClass = "ScalarLogicalExpr"; } +def OMPC_Nocontext : Clause<"nocontext"> { + let clangClass = "OMPNocontextClause"; + let flangClass = "ScalarLogicalExpr"; +} def OMPC_Detach : Clause<"detach"> { let clangClass = "OMPDetachClause"; } @@ -1667,7 +1671,8 @@ VersionedClause, VersionedClause, VersionedClause, -VersionedClause +VersionedClause, +VersionedClause ]; } def OMP_Unknown : Directive<"unknown"> { Index: flang/lib/Semantics/check-omp-structure.cpp === --- flang/lib/Semantics/check-omp-structure.cpp +++ flang/lib/Semantics/check-omp-structure.cpp @@ -730,6 +730,7 @@ CHECK_SIMPLE_CLAUSE(Init, OMPC_init) CHECK_SIMPLE_CLAUSE(Use, OMPC_use) CHECK_SIMPLE_CLAUSE(Novariants, OMPC_novariants) +CHECK_SIMPLE_CLAUSE(Nocontext, OMPC_nocontext) CHECK_REQ_SCALAR_INT_CLAUSE(Allocator, OMPC_allocator) CHECK_REQ_SCALAR_INT_CLAUSE(Grainsize, OMPC_grainsize) Index: clang/tools/libclang/CIndex.cpp === --- clang/tools/libclang/CIndex.cpp +++ clang/tools/libclang/CIndex.cpp @@ -2295,6 +2295,10 @@ Visitor->AddStmt(C->getCondition()); } +void OMPClauseEnqueue::VisitOMPNocontextClause(const OMPNocontextClause *C) { + Visitor->AddStmt(C->getCondition()); +} + void OMPClauseEnqueue::VisitOMPUnifiedAddressClause( const OMPUnifiedAddressClause *) {} Index: clang/test/OpenMP/dispatch_messages.cpp === --- clang/test/OpenMP/dispatch_messages.cpp +++ clang/test/OpenMP/dispatch_messages.cpp @@ -46,6 +46,24 @@ // expected-error@+1 {{use of undeclared identifier 'x'}} #pragma omp dispatch novariants(x) disp_call(); + + // expected-error@+1 {{expected '(' after 'nocontext'}} + #pragma omp dispatch nocontext + disp_call(); + + // expected-error@+3 {{expected expression}} + // expected-error@+2 {{expected ')'}} + // expected-note@+1 {{to match this '('}} + #pragma omp dispatch nocontext ( + disp_call(); + + // expected-error@+1 {{cannot contain more than one 'nocontext' clause}} + #pragma omp dispatch nocontext(dnum> 4) nocontext(3) + disp_call(); + + // expected-error@+1 {{use of undeclared identifier 'x'}} + #pragma omp dispatch nocontext(x) + disp_call(); } void testit_two() { Index: clang/test/OpenMP/dispatch_ast_print.cpp === --- clang/test/OpenMP/dispatch_ast_print.cpp +++ clang/test/OpenMP/dispatch_ast_print.cpp @@ -51,22 +51,22 @@ void test_one() { int aaa, bbb, var; - //PRINT: #pragma omp dispatch depend(in : var) nowait novariants(aaa > 5) + //PRINT: #pragma omp dispatch depend(in : var) nowait novariants(aaa > 5) nocontext(bbb > 5) //DUMP: OMPDispatchDirective //DUMP: OMPDependClause //DUMP: OMPNowaitClause //DUMP: OMPNovariantsClause - #pragma omp dispatch depend(in:var) nowait novariants(aaa > 5) + #pragma omp dispatch depend(in:var) nowait novariants(aaa > 5) nocontext(bbb > 5) foo(aaa, ); int *dp = get_device_ptr(); int dev = get_device(); - //PRINT: #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) + //PRINT: #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) nocontext(dev > 5) //DUMP: OMPDispatchDirective //DUMP: OMPDeviceClause //DUMP: OMPIs_device_ptrClause //DUMP: OMPNovariantsClause - #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) + #pragma omp dispatch device(dev) is_device_ptr(dp) novariants(dev > 10) nocontext(dev > 5)