diff options
author | Lang Hames <lhames@gmail.com> | 2016-05-26 19:44:33 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2016-05-26 19:44:33 +0000 |
commit | 4a59a34597f49665faf351d6ee65515aa5fb86da (patch) | |
tree | d2af8d655c4ce6f7267db82a4549f156d9278829 | |
parent | da0b9a959eaa5e1fc0e7879574eac214f95f00a5 (diff) | |
download | bcm5719-llvm-4a59a34597f49665faf351d6ee65515aa5fb86da.tar.gz bcm5719-llvm-4a59a34597f49665faf351d6ee65515aa5fb86da.zip |
[Kaleidoscope][BuildingAJIT] Fix a bug in the symbol resolver in Chapter2.
Symbol resolution should be done on the top layer of the stack unless there's a
good reason to do otherwise. In this case it would have worked because
OptimizeLayer::addModuleSet eagerly passes all modules down to the
CompileLayer, meaning that searches in CompileLayer will find the definitions.
In later chapters where the top layer's addModuleSet isn't a pass-through, this
would break.
llvm-svn: 270899
-rw-r--r-- | llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h index 6ea559bec0a..754c382a1df 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h @@ -71,7 +71,7 @@ public: // Lambda 2: Search for external symbols in the host process. auto Resolver = createLambdaResolver( [&](const std::string &Name) { - if (auto Sym = CompileLayer.findSymbol(Name, false)) + if (auto Sym = OptimizeLayer.findSymbol(Name, false)) return RuntimeDyld::SymbolInfo(Sym.getAddress(), Sym.getFlags()); return RuntimeDyld::SymbolInfo(nullptr); }, |