[PATCH] D19263: Enable ODR uniquing of DITypes in more places

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 08:35:24 PDT 2016


> On 2016-Apr-19, at 08:30, Teresa Johnson <tejohnson at google.com> wrote:
> 
> tejohnson created this revision.
> tejohnson added reviewers: dexonsmith, joker.eph.
> tejohnson added a subscriber: llvm-commits.
> Herald added a subscriber: joker.eph.
> 
> This is a follow-on to apply Duncan's new DIType ODR uniquing from
> r266549 and r266713 in more places.
> 
> Enable enableDebugTypeODRUniquing() for ThinLTO backends invoked via
> libLTO, similar to the way r266549 enabled this for ThinLTO backend
> threads launched from gold-plugin.
> 
> Also enable enableDebugTypeODRUniquing in opt, similar to the way
> r266549 enabled this for llvm-link (on by default, can be disabled with
> new -disable-debug-info-type-map option), since we may perform ThinLTO
> importing from opt.
> 
> http://reviews.llvm.org/D19263
> 
> Files:
>  lib/LTO/ThinLTOCodeGenerator.cpp
>  tools/opt/opt.cpp
> 
> Index: tools/opt/opt.cpp
> ===================================================================
> --- tools/opt/opt.cpp
> +++ tools/opt/opt.cpp
> @@ -102,6 +102,10 @@
> VerifyEach("verify-each", cl::desc("Verify after each transform"));
> 
> static cl::opt<bool>
> +    DisableDITypeMap("disable-debug-info-type-map",
> +                     cl::desc("Don't use a uniquing type map for debug info"));
> +
> +static cl::opt<bool>
> StripDebug("strip-debug",
>            cl::desc("Strip debugger symbol info from translation unit"));
> 
> @@ -365,6 +369,8 @@
>   SMDiagnostic Err;
> 
>   Context.setDiscardValueNames(DiscardValueNames);
> +  if (!DisableDITypeMap)
> +    Context.enableDebugTypeODRUniquing();

Thanks, I didn't realize opt did linking now.

> 
>   // Load the input module...
>   std::unique_ptr<Module> M = parseIRFile(InputFilename, Err, Context);
> Index: lib/LTO/ThinLTOCodeGenerator.cpp
> ===================================================================
> --- lib/LTO/ThinLTOCodeGenerator.cpp
> +++ lib/LTO/ThinLTOCodeGenerator.cpp
> @@ -521,6 +521,7 @@
>       Pool.async([&](int count) {
>         LLVMContext Context;
>         Context.setDiscardValueNames(LTODiscardValueNames);
> +        Context.enableDebugTypeODRUniquing();

!!! This was a major oversight.  I mistakenly assumed the context in the
LTOCodeGenerator was the only one (even though -flto=thin is multithreaded;
I guess I just wasn't thinking).

LGTM.  Thanks.

> 
>         // Parse module now
>         auto TheModule = loadModuleFromBuffer(ModuleBuffer, Context, false);
> 
> 
> <D19263.54197.patch>



More information about the llvm-commits mailing list