[llvm] r306736 - Attempt to fix Orc JIT test timeouts

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 13:15:08 PDT 2017


Author: rnk
Date: Thu Jun 29 13:15:08 2017
New Revision: 306736

URL: http://llvm.org/viewvc/llvm-project?rev=306736&view=rev
Log:
Attempt to fix Orc JIT test timeouts

I think there are some destruction ordering issues here. The
ShouldDelete map seems to be getting destroyed before the shared_ptr
deleter lambda accesses it. In any case, this avoids inserting elements
into the map during shutdown.

Modified:
    llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h

Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=306736&r1=306735&r2=306736&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h Thu Jun 29 13:15:08 2017
@@ -193,11 +193,11 @@ public:
     }
     auto *MPtr = M.release();
     ShouldDelete[MPtr] = true;
-    auto Deleter =
-      [this](Module *Mod) {
-        if (ShouldDelete[Mod])
-	  delete Mod;
-      };
+    auto Deleter = [this](Module *Mod) {
+      auto I = ShouldDelete.find(Mod);
+      if (I != ShouldDelete.end() && I->second)
+        delete Mod;
+    };
     LocalModules.push_back(std::shared_ptr<Module>(MPtr, std::move(Deleter)));
     LazyEmitLayer.addModule(LocalModules.back(), &MemMgr, &Resolver);
   }




More information about the llvm-commits mailing list