]> granicus.if.org Git - llvm/commitdiff
Attempt to fix Orc JIT test timeouts
authorReid Kleckner <rnk@google.com>
Thu, 29 Jun 2017 20:15:08 +0000 (20:15 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 29 Jun 2017 20:15:08 +0000 (20:15 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306736 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/Orc/OrcMCJITReplacement.h

index b20690c7caafce4b023a2aa37db1b7599fcb6905..690276232a6f8ceb3b6dcb7a8f66cdb98bb89f3b 100644 (file)
@@ -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);
   }