summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-08-04 23:08:57 +0000
committerAdrian Prantl <aprantl@apple.com>2017-08-04 23:08:57 +0000
commitb44230213101a3de3f9077e63de9fcf2d849c765 (patch)
treec3b6649b7244d03374e37673ddc2f4e98f0a81b1 /clang
parent138a3fbae1ca90dc6d2760e859a08c99a6f4ab3d (diff)
downloadbcm5719-llvm-b44230213101a3de3f9077e63de9fcf2d849c765.tar.gz
bcm5719-llvm-b44230213101a3de3f9077e63de9fcf2d849c765.zip
Debug Info: Set the DICompileUnit's isOptimized flag when compiling with LTO.
rdar://problem/27640939 llvm-svn: 310147
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp11
-rw-r--r--clang/test/CodeGen/debug-info-lto.c4
2 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index c9aa04815f1..e5955c0b8ba 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -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) {
diff --git a/clang/test/CodeGen/debug-info-lto.c b/clang/test/CodeGen/debug-info-lto.c
new file mode 100644
index 00000000000..5dab0a12641
--- /dev/null
+++ b/clang/test/CodeGen/debug-info-lto.c
@@ -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
OpenPOWER on IntegriCloud