[PATCH] D101952: [OpenMP] Fix non-determinism in clang copyin codegen

Giorgis Georgakoudis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 5 15:48:11 PDT 2021


ggeorgakoudis created this revision.
Herald added subscribers: mgrang, guansong, yaxunl.
ggeorgakoudis requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101952

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp


Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===================================================================
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -971,7 +971,7 @@
   // operator=(threadprivate_var2, master_threadprivate_var2);
   // ...
   // __kmpc_barrier(&loc, global_tid);
-  llvm::DenseSet<const VarDecl *> CopiedVars;
+  llvm::SetVector<const VarDecl *> CopiedVars;
   llvm::BasicBlock *CopyBegin = nullptr, *CopyEnd = nullptr;
   for (const auto *C : D.getClausesOfKind<OMPCopyinClause>()) {
     auto IRef = C->varlist_begin();
@@ -980,7 +980,7 @@
     for (const Expr *AssignOp : C->assignment_ops()) {
       const auto *VD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
       QualType Type = VD->getType();
-      if (CopiedVars.insert(VD->getCanonicalDecl()).second) {
+      if (CopiedVars.insert(VD->getCanonicalDecl())) {
         // Get the address of the master variable. If we are emitting code with
         // TLS support, the address is passed from the master as field in the
         // captured declaration.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101952.343218.patch
Type: text/x-patch
Size: 1084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210505/4855171e/attachment.bin>


More information about the cfe-commits mailing list