[llvm] r218702 - Disable the -gmlt optimization implemented in r218129 under Darwin due to issues with dsymutil.
David Blaikie
dblaikie at gmail.com
Tue Sep 30 14:28:33 PDT 2014
Author: dblaikie
Date: Tue Sep 30 16:28:32 2014
New Revision: 218702
URL: http://llvm.org/viewvc/llvm-project?rev=218702&view=rev
Log:
Disable the -gmlt optimization implemented in r218129 under Darwin due to issues with dsymutil.
r218129 omits DW_TAG_subprograms which have no inlined subroutines when
emitting -gmlt data. This makes -gmlt very low cost for -O0 builds.
Darwin's dsymutil reasonably considers a CU empty if it has no
subprograms (which occurs with the above optimization in -O0 programs
without any force_inline function calls) and drops the line table, CU,
and everything in this situation, making backtraces impossible.
Until dsymutil is modified to account for this, disable this
optimization on Darwin to preserve the desired functionality.
(see r218545, which should be reverted after this patch, for other
discussion/details)
Footnote:
In the long term, it doesn't look like this scheme (of simplified debug
info to describe inlining to enable backtracing) is tenable, it is far
too size inefficient for optimized code (the DW_TAG_inlined_subprograms,
even once compressed, are nearly twice as large as the line table
itself (also compressed)) and we'll be considering things like Cary's
two level line table proposal to encode all this information directly in
the line table.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/trunk/test/DebugInfo/gmlt.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=218702&r1=218701&r2=218702&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Sep 30 16:28:32 2014
@@ -171,6 +171,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
GlobalRangeCount(0), InfoHolder(A, "info_string", DIEValueAllocator),
UsedNonDefaultText(false),
SkeletonHolder(A, "skel_string", DIEValueAllocator),
+ IsDarwin(Triple(A->getTargetTriple()).isOSDarwin()),
AccelNames(DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset,
dwarf::DW_FORM_data4)),
AccelObjC(DwarfAccelTable::Atom(dwarf::DW_ATOM_die_offset,
@@ -190,8 +191,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Mo
// Turn on accelerator tables for Darwin by default, pubnames by
// default for non-Darwin, and handle split dwarf.
- bool IsDarwin = Triple(A->getTargetTriple()).isOSDarwin();
-
if (DwarfAccelTables == Default)
HasDwarfAccelTables = IsDarwin;
else
@@ -1698,7 +1697,7 @@ void DwarfDebug::endFunction(const Machi
// Under -gmlt, skip building the subprogram if there are no inlined
// subroutines inside it.
if (TheCU.getCUNode().getEmissionKind() == DIBuilder::LineTablesOnly &&
- LScopes.getAbstractScopesList().empty()) {
+ LScopes.getAbstractScopesList().empty() && !IsDarwin) {
assert(ScopeVariables.empty());
assert(CurrentFnArguments.empty());
assert(DbgValues.empty());
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=218702&r1=218701&r2=218702&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Tue Sep 30 16:28:32 2014
@@ -319,6 +319,7 @@ class DwarfDebug : public AsmPrinterHand
// True iff there are multiple CUs in this module.
bool SingleCU;
+ bool IsDarwin;
AddressPool AddrPool;
Modified: llvm/trunk/test/DebugInfo/gmlt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/gmlt.ll?rev=218702&r1=218701&r2=218702&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/gmlt.ll (original)
+++ llvm/trunk/test/DebugInfo/gmlt.ll Tue Sep 30 16:28:32 2014
@@ -1,5 +1,7 @@
; REQUIRES: object-emission
; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
+; RUN: %llc_dwarf -O0 -filetype=obj < %s -mtriple x86_64-apple-darwin | llvm-dwarfdump - \
+; RUN: | FileCheck --check-prefix=CHECK --check-prefix=DARWIN %s
; Generated from the following source compiled with clang++ -gmlt:
; void f1() {}
@@ -17,6 +19,25 @@
; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000)
; CHECK-NOT: {{DW_TAG|NULL}}
+; Omitting the subprograms without inlined subroutines is not possible
+; currently on Darwin as dsymutil will drop the whole CU if it has no subprograms
+; (which happens with this optimization if there are no inlined subroutines).
+
+; DARWIN: DW_TAG_subprogram
+; DARWIN-NOT: DW_TAG
+; DARWIN: DW_AT_name {{.*}} "f1"
+; DARWIN-NOT: {{DW_TAG|NULL}}
+; DARWIN: DW_TAG_subprogram
+; DARWIN-NOT: DW_TAG
+; DARWIN: DW_AT_name {{.*}} "f2"
+; DARWIN-NOT: {{DW_TAG|NULL}}
+; DARWIN: DW_TAG_subprogram
+; DARWIN-NOT: DW_TAG
+; Can't check the abstract_origin value across the DARWIN/CHECK checking and
+; ordering, so don't bother - just trust me, it refers to f3 down there.
+; DARWIN: DW_AT_abstract_origin
+; DARWIN-NOT: {{DW_TAG|NULL}}
+
; FIXME: Emitting separate abstract definitions is inefficient when we could
; just attach the DW_AT_name to the inlined_subroutine directly. Except that
More information about the llvm-commits
mailing list