[clang] 313ee60 - [OpenMP] Fix non-determinism in clang task codegen (lastprivates)

Giorgis Georgakoudis via cfe-commits cfe-commits at lists.llvm.org
Tue May 4 11:56:37 PDT 2021


Author: Giorgis Georgakoudis
Date: 2021-05-04T11:56:31-07:00
New Revision: 313ee609e16b93a7d81cd595f8cffdb408390495

URL: https://github.com/llvm/llvm-project/commit/313ee609e16b93a7d81cd595f8cffdb408390495
DIFF: https://github.com/llvm/llvm-project/commit/313ee609e16b93a7d81cd595f8cffdb408390495.diff

LOG: [OpenMP] Fix non-determinism in clang task codegen (lastprivates)

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D101800

Added: 
    

Modified: 
    clang/lib/CodeGen/CGStmtOpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index e7ddc0aa4c8d..1f714b01b3f1 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4293,7 +4293,7 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(
     }
   }
   // Get list of lastprivate variables (for taskloops).
-  llvm::DenseMap<const VarDecl *, const DeclRefExpr *> LastprivateDstsOrigs;
+  llvm::MapVector<const VarDecl *, const DeclRefExpr *> LastprivateDstsOrigs;
   for (const auto *C : S.getClausesOfKind<OMPLastprivateClause>()) {
     auto IRef = C->varlist_begin();
     auto ID = C->destination_exprs().begin();
@@ -4304,8 +4304,8 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(
         Data.LastprivateCopies.push_back(IInit);
       }
       LastprivateDstsOrigs.insert(
-          {cast<VarDecl>(cast<DeclRefExpr>(*ID)->getDecl()),
-           cast<DeclRefExpr>(*IRef)});
+          std::make_pair(cast<VarDecl>(cast<DeclRefExpr>(*ID)->getDecl()),
+                         cast<DeclRefExpr>(*IRef)));
       ++IRef;
       ++ID;
     }


        


More information about the cfe-commits mailing list