diff --git a/lib/LTO/ThinLTOCodeGenerator.cpp b/lib/LTO/ThinLTOCodeGenerator.cpp index ab13ec821aa..271520e4dd3 100644 --- a/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/lib/LTO/ThinLTOCodeGenerator.cpp @@ -575,6 +575,7 @@ void ThinLTOCodeGenerator::run() { Pool.async([&](int count) { LLVMContext Context; Context.setDiscardValueNames(LTODiscardValueNames); + Context.enableDebugTypeODRUniquing(); auto ModuleIdentifier = ModuleBuffer.getBufferIdentifier(); DenseMap ResolvedODR; diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 96dee1ba598..641735c2998 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -101,6 +101,10 @@ NoVerify("disable-verify", cl::desc("Do not run the verifier"), cl::Hidden); static cl::opt VerifyEach("verify-each", cl::desc("Verify after each transform")); +static cl::opt + DisableDITypeMap("disable-debug-info-type-map", + cl::desc("Don't use a uniquing type map for debug info")); + static cl::opt StripDebug("strip-debug", cl::desc("Strip debugger symbol info from translation unit")); @@ -365,6 +369,8 @@ int main(int argc, char **argv) { SMDiagnostic Err; Context.setDiscardValueNames(DiscardValueNames); + if (!DisableDITypeMap) + Context.enableDebugTypeODRUniquing(); // Load the input module... std::unique_ptr M = parseIRFile(InputFilename, Err, Context);