r292794 - [OpenMP] DSAChecker bug fix for combined directives.

Arpith Chacko Jacob via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 07:38:49 PST 2017


Author: arpith
Date: Mon Jan 23 09:38:49 2017
New Revision: 292794

URL: http://llvm.org/viewvc/llvm-project?rev=292794&view=rev
Log:
[OpenMP] DSAChecker bug fix for combined directives.

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.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29026

Modified:
    cfe/trunk/lib/Sema/SemaOpenMP.cpp
    cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=292794&r1=292793&r2=292794&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Jan 23 09:38:49 2017
@@ -2268,7 +2268,11 @@ StmtResult Sema::ActOnOpenMPExecutableDi
 
     // 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.

Modified: cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp?rev=292794&r1=292793&r2=292794&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/target_parallel_default_messages.cpp Mon Jan 23 09:38:49 2017
@@ -23,5 +23,8 @@ int main(int argc, char **argv) {
   foo();
   #pragma omp target parallel default(shared)
   ++argc;
+  #pragma omp target parallel default(none)
+  #pragma omp parallel default(shared)
+  ++argc;
   return 0;
 }




More information about the cfe-commits mailing list