[llvm] r369219 - [ORC] Make sure we linker-mangle symbol names in the SpeculationLayer.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 18 14:29:57 PDT 2019


Author: lhames
Date: Sun Aug 18 14:29:57 2019
New Revision: 369219

URL: http://llvm.org/viewvc/llvm-project?rev=369219&view=rev
Log:
[ORC] Make sure we linker-mangle symbol names in the SpeculationLayer.

If mangling is not performed then speculative lookups will fail.

Modified:
    llvm/trunk/examples/SpeculativeJIT/SpeculativeJIT.cpp
    llvm/trunk/include/llvm/ExecutionEngine/Orc/Speculation.h

Modified: llvm/trunk/examples/SpeculativeJIT/SpeculativeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/SpeculativeJIT/SpeculativeJIT.cpp?rev=369219&r1=369218&r2=369219&view=diff
==============================================================================
--- llvm/trunk/examples/SpeculativeJIT/SpeculativeJIT.cpp (original)
+++ llvm/trunk/examples/SpeculativeJIT/SpeculativeJIT.cpp Sun Aug 18 14:29:57 2019
@@ -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(

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/Speculation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/Speculation.h?rev=369219&r1=369218&r2=369219&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/Speculation.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Speculation.h Sun Aug 18 14:29:57 2019
@@ -157,8 +157,10 @@ public:
   using TargetAndLikelies = DenseMap<SymbolStringPtr, SymbolNameSet>;
 
   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<SymbolStringPtr> 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;




More information about the llvm-commits mailing list