Skip to content

Commit

Permalink
[ORC] Make sure we linker-mangle symbol names in the SpeculationLayer.
Browse files Browse the repository at this point in the history
If mangling is not performed then speculative lookups will fail.

llvm-svn: 369219
  • Loading branch information
lhames committed Aug 18, 2019
1 parent a264b60 commit cf276ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class SpeculativeJIT {
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(
Expand Down
13 changes: 7 additions & 6 deletions llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ class IRSpeculationLayer : public IRLayer {
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);
}

Expand All @@ -170,19 +172,18 @@ class IRSpeculationLayer : public IRLayer {
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;
Expand Down

0 comments on commit cf276ba

Please sign in to comment.