[PATCH] D29026: [OpenMP] DSAChecker bug fix for combined directives.
Arpith Jacob via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 23 07:14:50 PST 2017
arpith-jacob created this revision.
The DSAChecker code in SemaOpenMP looks at the captured statement
associated with an OpenMP directive. A combined directive such as
'target parallel' has nested capture statements, which have to be
fully traversed before executing the DSAChecker. This is a patch
to perform the traversal for such combined directives.
https://reviews.llvm.org/D29026
Files:
lib/Sema/SemaOpenMP.cpp
test/OpenMP/target_parallel_default_messages.cpp
Index: test/OpenMP/target_parallel_default_messages.cpp
===================================================================
--- test/OpenMP/target_parallel_default_messages.cpp
+++ test/OpenMP/target_parallel_default_messages.cpp
@@ -23,5 +23,8 @@
foo();
#pragma omp target parallel default(shared)
++argc;
+ #pragma omp target parallel default(none)
+ #pragma omp parallel default(shared)
+ ++argc;
return 0;
}
Index: lib/Sema/SemaOpenMP.cpp
===================================================================
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -2268,7 +2268,11 @@
// Check default data sharing attributes for referenced variables.
DSAAttrChecker DSAChecker(DSAStack, *this, cast<CapturedStmt>(AStmt));
- DSAChecker.Visit(cast<CapturedStmt>(AStmt)->getCapturedStmt());
+ int ThisCaptureLevel = getOpenMPCaptureLevels(Kind);
+ Stmt *S = AStmt;
+ while (--ThisCaptureLevel >= 0)
+ S = cast<CapturedStmt>(S)->getCapturedStmt();
+ DSAChecker.Visit(S);
if (DSAChecker.isErrorFound())
return StmtError();
// Generate list of implicitly defined firstprivate variables.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29026.85382.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170123/18a1ca57/attachment.bin>
More information about the cfe-commits
mailing list