From 9ec5a61358fa7e5f4af389562a62400dd7201504 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Tue, 23 Aug 2016 16:53:34 +0000 Subject: [PATCH] [ThinLTO] Make sure the Context used for the ThinLTO backend has all 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. llvm-svn: 279532 --- llvm/lib/LTO/LTO.cpp | 2 +- llvm/lib/LTO/LTOBackend.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 39ec4e2..8d4f1a4 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -468,7 +468,7 @@ public: const FunctionImporter::ImportMapTy &ImportList, const GVSummaryMapTy &DefinedGlobals, MapVector &ModuleMap) { - LLVMContext BackendContext; + LTOLLVMContext BackendContext(Conf); ErrorOr> MOrErr = parseBitcodeFile(MBRef, BackendContext); diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 732f35a..20e2b9e 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -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(), -- 2.7.4