DebugInfo: Add flag to CU to disable emission of inline debug info into the skeleton CU
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 24 Aug 2016 18:29:58 +0000 (18:29 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 24 Aug 2016 18:29:58 +0000 (18:29 +0000)
In cases where .dwo/.dwp files are guaranteed to be available, skipping
the extra online (in the .o file) inline info can save a substantial
amount of space - see the original r221306 for more details there.

llvm-svn: 279651

clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/CodeGenOptions.def
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/Driver/Tools.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/debug-info-imported-entity.cpp
clang/test/CodeGen/split-debug-filename.c
clang/test/CodeGen/split-debug-inlining.c [new file with mode: 0644]

index 57d5bcb..44e588d 100644 (file)
@@ -1255,6 +1255,10 @@ def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group<f_Group>,
   Flags<[CC1Option]>, HelpText<"Place debug types in their own section (ELF Only)">;
 def fno_debug_types_section: Flag<["-"], "fno-debug-types-section">, Group<f_Group>,
   Flags<[CC1Option]>;
+def fsplit_dwarf_inlining: Flag <["-"], "fsplit-dwarf-inlining">, Group<f_Group>,
+  Flags<[CC1Option]>, HelpText<"Place debug types in their own section (ELF Only)">;
+def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, Group<f_Group>,
+  Flags<[CC1Option]>;
 def fdebug_prefix_map_EQ
   : Joined<["-"], "fdebug-prefix-map=">, Group<f_Group>, Flags<[CC1Option]>,
     HelpText<"remap file source paths in debug info">;
index 51b0cf6..4dd634c 100644 (file)
@@ -194,6 +194,9 @@ CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should contain
 CODEGENOPT(DebugExplicitImport, 1, 0)  ///< Whether or not debug info should
                                        ///< contain explicit imports for
                                        ///< anonymous namespaces
+CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the
+                                     ///< skeleton CU to allow for symbolication
+                                    ///< of inline stack frames without .dwo files.
 
 CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists.
 
index d515e1a..2f250d8 100644 (file)
@@ -454,7 +454,8 @@ void CGDebugInfo::CreateCompileUnit() {
   TheCU = DBuilder.createCompileUnit(
       LangTag, remapDIPath(MainFileName), remapDIPath(getCurrentDirname()),
       Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers,
-      CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */);
+      CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */,
+      CGM.getCodeGenOpts().SplitDwarfInlining);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
index 895104e..c1d68bc 100644 (file)
@@ -4697,6 +4697,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back("-generate-type-units");
   }
 
+  if (!Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
+                    options::OPT_fno_split_dwarf_inlining, true))
+    CmdArgs.push_back("-fno-split-dwarf-inlining");
+
   // CloudABI and WebAssembly use -ffunction-sections and -fdata-sections by
   // default.
   bool UseSeparateSections = Triple.getOS() == llvm::Triple::CloudABI ||
index 69c4593..97c37de 100644 (file)
@@ -499,6 +499,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
   Opts.WholeProgramVTables = Args.hasArg(OPT_fwhole_program_vtables);
   Opts.LTOVisibilityPublicStd = Args.hasArg(OPT_flto_visibility_public_std);
   Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
+  Opts.SplitDwarfInlining = !Args.hasArg(OPT_fno_split_dwarf_inlining);
   Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
   Opts.DebugExplicitImport = Triple.isPS4CPU();
 
index 105cc3d..c7935ed 100644 (file)
@@ -3,9 +3,7 @@
 namespace std { class A; }
 using std::A; using ::A;
 
-
-// CHECK: [[CompileUnit:![0-9]+]] = distinct !DICompileUnit({{.+}} imports: [[Imports:![0-9]+]])
+// CHECK: [[CompileUnit:![0-9]+]] = distinct !DICompileUnit({{.+}} imports: [[Imports:![0-9]+]]
 // CHECK: [[Imports]] = !{[[ImportedEntity:![0-9]+]]}
 // CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: [[STDA:![0-9]+]], line: 4)
 // CHECK: [[STDA]] = !DICompositeType(tag: DW_TAG_class_type, name: "A",
-
index 63970a8..43daead 100644 (file)
@@ -1,7 +1,7 @@
-// RUN: %clang -target x86_64-linux-gnu -gsplit-dwarf -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -split-dwarf-file foo.dwo -S -emit-llvm -o - %s | FileCheck %s
 int main (void) {
   return 0;
 }
 
 // Testing to ensure that the dwo name gets output into the compile unit.
-// CHECK: split-debug-filename.dwo
+// CHECK: !DICompileUnit({{.*}}, splitDebugFilename: "foo.dwo"
diff --git a/clang/test/CodeGen/split-debug-inlining.c b/clang/test/CodeGen/split-debug-inlining.c
new file mode 100644 (file)
index 0000000..4a306d4
--- /dev/null
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -debug-info-kind=limited -fno-split-dwarf-inlining -S -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -debug-info-kind=limited -S -emit-llvm -o - %s | FileCheck --check-prefix=ABSENT %s
+void f(void) {}
+// Verify that disabling split debug inlining info is propagated to the debug
+// info metadata.
+// CHECK: !DICompileUnit({{.*}}, splitDebugInlining: false
+// ABSENT-NOT: splitDebugInlining