From: Reid Kleckner Date: Thu, 29 Jun 2017 20:15:08 +0000 (+0000) Subject: Attempt to fix Orc JIT test timeouts X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c48ce48f37171587fc9ed752623616bf57b615e;p=llvm 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306736 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h index b20690c7caa..690276232a6 100644 --- a/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h +++ b/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h @@ -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(MPtr, std::move(Deleter))); LazyEmitLayer.addModule(LocalModules.back(), &MemMgr, &Resolver); }