From bf352f52b5a16a9676edcd96aec2366ae9ad1b61 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sun, 18 Aug 2019 21:29:57 +0000 Subject: [PATCH] [ORC] Make sure we linker-mangle symbol names in the SpeculationLayer. If mangling is not performed then speculative lookups will fail. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369219 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/SpeculativeJIT/SpeculativeJIT.cpp | 2 +- include/llvm/ExecutionEngine/Orc/Speculation.h | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/SpeculativeJIT/SpeculativeJIT.cpp b/examples/SpeculativeJIT/SpeculativeJIT.cpp index 803badb59d9..bb075bd56b5 100644 --- a/examples/SpeculativeJIT/SpeculativeJIT.cpp +++ b/examples/SpeculativeJIT/SpeculativeJIT.cpp @@ -105,7 +105,7 @@ private: CompileLayer(*this->ES, ObjLayer, ConcurrentIRCompiler(std::move(JTMB))), S(Imps, *this->ES), - SpeculateLayer(*this->ES, CompileLayer, S, BlockFreqQuery()), + SpeculateLayer(*this->ES, CompileLayer, S, Mangle, BlockFreqQuery()), CODLayer(*this->ES, SpeculateLayer, *this->LCTMgr, std::move(ISMBuilder)) { this->ES->getMainJITDylib().addGenerator( diff --git a/include/llvm/ExecutionEngine/Orc/Speculation.h b/include/llvm/ExecutionEngine/Orc/Speculation.h index 1899b60f076..bf24b587218 100644 --- a/include/llvm/ExecutionEngine/Orc/Speculation.h +++ b/include/llvm/ExecutionEngine/Orc/Speculation.h @@ -157,8 +157,10 @@ public: using TargetAndLikelies = DenseMap; IRSpeculationLayer(ExecutionSession &ES, IRCompileLayer &BaseLayer, - Speculator &Spec, ResultEval Interpreter) - : IRLayer(ES), NextLayer(BaseLayer), S(Spec), QueryAnalysis(Interpreter) { + Speculator &Spec, MangleAndInterner &Mangle, + ResultEval Interpreter) + : IRLayer(ES), NextLayer(BaseLayer), S(Spec), Mangle(Mangle), + QueryAnalysis(Interpreter) { PB.registerFunctionAnalyses(FAM); } @@ -170,19 +172,18 @@ private: assert(!IRNames.empty() && "No IRNames received to Intern?"); TargetAndLikelies InternedNames; DenseSet TargetJITNames; - ExecutionSession &Es = getExecutionSession(); for (auto &NamePair : IRNames) { for (auto &TargetNames : NamePair.second) - TargetJITNames.insert(Es.intern(TargetNames)); + TargetJITNames.insert(Mangle(TargetNames)); - InternedNames.insert( - {Es.intern(NamePair.first), std::move(TargetJITNames)}); + InternedNames[Mangle(NamePair.first)] = std::move(TargetJITNames); } return InternedNames; } IRCompileLayer &NextLayer; Speculator &S; + MangleAndInterner &Mangle; PassBuilder PB; FunctionAnalysisManager FAM; ResultEval QueryAnalysis; -- 2.40.0