Author: adrian Date: Fri Aug 4 16:08:57 2017 New Revision: 310147 URL: http://llvm.org/viewvc/llvm-project?rev=310147&view=rev Log: Debug Info: Set the DICompileUnit's isOptimized flag when compiling with LTO.
rdar://problem/27640939 Added: cfe/trunk/test/CodeGen/debug-info-lto.c Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=310147&r1=310146&r2=310147&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Aug 4 16:08:57 2017 @@ -527,16 +527,15 @@ void CGDebugInfo::CreateCompileUnit() { // Create new compile unit. // FIXME - Eliminate TheCU. + auto &CGOpts = CGM.getCodeGenOpts(); TheCU = DBuilder.createCompileUnit( LangTag, DBuilder.createFile(remapDIPath(MainFileName), remapDIPath(getCurrentDirname()), CSKind, Checksum), - Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers, - CGM.getCodeGenOpts().EnableSplitDwarf - ? "" - : CGM.getCodeGenOpts().SplitDwarfFile, - EmissionKind, 0 /* DWOid */, CGM.getCodeGenOpts().SplitDwarfInlining, - CGM.getCodeGenOpts().DebugInfoForProfiling); + Producer, LO.Optimize || CGOpts.PrepareForLTO || CGOpts.EmitSummaryIndex, + CGOpts.DwarfDebugFlags, RuntimeVers, + CGOpts.EnableSplitDwarf ? "" : CGOpts.SplitDwarfFile, EmissionKind, + 0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling); } llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) { Added: cfe/trunk/test/CodeGen/debug-info-lto.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-lto.c?rev=310147&view=auto ============================================================================== --- cfe/trunk/test/CodeGen/debug-info-lto.c (added) +++ cfe/trunk/test/CodeGen/debug-info-lto.c Fri Aug 4 16:08:57 2017 @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -flto -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s +// RUN: %clang_cc1 -flto=thin -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s +// The "o" in LTO stands for optimization! +// CHECK: !DICompileUnit({{.*}} isOptimized: true _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits