[llvm] r279532 - [ThinLTO] Make sure the Context used for the ThinLTO backend has all the appropriate options

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 09:53:35 PDT 2016


Author: mehdi_amini
Date: Tue Aug 23 11:53:34 2016
New Revision: 279532

URL: http://llvm.org/viewvc/llvm-project?rev=279532&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/LTO/LTO.cpp
    llvm/trunk/lib/LTO/LTOBackend.cpp

Modified: llvm/trunk/lib/LTO/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTO.cpp?rev=279532&r1=279531&r2=279532&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTO.cpp (original)
+++ llvm/trunk/lib/LTO/LTO.cpp Tue Aug 23 11:53:34 2016
@@ -468,7 +468,7 @@ public:
                           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);

Modified: llvm/trunk/lib/LTO/LTOBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOBackend.cpp?rev=279532&r1=279531&r2=279532&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOBackend.cpp (original)
+++ llvm/trunk/lib/LTO/LTOBackend.cpp Tue Aug 23 11:53:34 2016
@@ -271,6 +271,8 @@ Error lto::thinBackend(Config &Conf, uns
     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(),




More information about the llvm-commits mailing list