Skip to content

Commit

Permalink
[ThinLTO] Make sure the Context used for the ThinLTO backend has all …
Browse files Browse the repository at this point in the history
…the appropriate options

An important performance setting on the LLVMContext for LTO is
enableDebugTypeODRUniquing(), this adds an automatic merging of
debug information in the context based on type ids.

Also, the lto::Config includes a diagnostic handler that needs to
be set on the Context, as well as the setDiscardValueNames() setting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279532 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
joker-eph committed Aug 23, 2016
1 parent d09e4ee commit 52a318c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/LTO/LTO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class InProcessThinBackend : public ThinBackendProc {
const FunctionImporter::ImportMapTy &ImportList,
const GVSummaryMapTy &DefinedGlobals,
MapVector<StringRef, MemoryBufferRef> &ModuleMap) {
LLVMContext BackendContext;
LTOLLVMContext BackendContext(Conf);

ErrorOr<std::unique_ptr<Module>> MOrErr =
parseBitcodeFile(MBRef, BackendContext);
Expand Down
2 changes: 2 additions & 0 deletions lib/LTO/LTOBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddOutputFn AddOutput,
return Error();

auto ModuleLoader = [&](StringRef Identifier) {
assert(Mod.getContext().isODRUniquingDebugTypes() &&
"ODR Type uniquing shoudl be enabled on the context");
return std::move(getLazyBitcodeModule(MemoryBuffer::getMemBuffer(
ModuleMap[Identifier], false),
Mod.getContext(),
Expand Down

0 comments on commit 52a318c

Please sign in to comment.