forked from OSchip/llvm-project
[DWARF] Preserve column number when emitting 'line 0' record
Follow-up to r289256, address a FIXME to avoid resetting the column number. This reduced .debug_line by 2.6% in a RelWithDebInfo self-build of clang. llvm-svn: 289620
This commit is contained in:
parent
f6b069c7db
commit
8fec3da00c
|
@ -1048,11 +1048,16 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
|
|||
// location from the physically previous (maybe unrelated) block.
|
||||
if (UnknownLocations == Enable || PrevLabel ||
|
||||
(PrevInstBB && PrevInstBB != MI->getParent())) {
|
||||
// Preserve the file number, if we can, to save space in the line table.
|
||||
// Preserve the file and column numbers, if we can, to save space in
|
||||
// the encoded line table.
|
||||
// Do not update PrevInstLoc, it remembers the last non-0 line.
|
||||
// FIXME: Also preserve the column number, to save more space?
|
||||
const MDNode *Scope = PrevInstLoc ? PrevInstLoc.getScope() : nullptr;
|
||||
recordSourceLine(0, 0, Scope, 0);
|
||||
const MDNode *Scope = nullptr;
|
||||
unsigned Column = 0;
|
||||
if (PrevInstLoc) {
|
||||
Scope = PrevInstLoc.getScope();
|
||||
Column = PrevInstLoc.getCol();
|
||||
}
|
||||
recordSourceLine(/*Line=*/0, Column, Scope, /*Flags=*/0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
; RUN: llc < %s -asm-verbose=false -mtriple=x86_64-apple-darwin10 -use-unknown-locations=Enable | FileCheck %s
|
||||
|
||||
; The divide instruction does not have a debug location. CodeGen should
|
||||
; represent this in the debug information. This is done by setting line
|
||||
; and column to 0
|
||||
; represent this in the debug information. This is done by setting line to 0.
|
||||
|
||||
; CHECK: leal
|
||||
; CHECK-NEXT: .loc 1 0 0
|
||||
; CHECK-NEXT: .loc 1 0 3
|
||||
; CHECK: cltd
|
||||
; CHECK-NEXT: idivl
|
||||
; CHECK-NEXT: .loc 1 4 3
|
||||
|
|
|
@ -42,11 +42,11 @@ if.end: ; preds = %if.then, %entry
|
|||
|
||||
; CHECK: .loc 1 7 7
|
||||
; CHECK-NOT: .loc
|
||||
; CHECK: .loc 1 0 0 is_stmt 0
|
||||
; CHECK: .loc 1 0 7 is_stmt 0
|
||||
; CHECK-NOT: .loc
|
||||
; CHECK: .loc 2 20 5 is_stmt 1
|
||||
; CHECK: .LBB0_2:
|
||||
; CHECK-NEXT: .loc 2 0 0 is_stmt 0
|
||||
; CHECK-NEXT: .loc 2 0 5 is_stmt 0
|
||||
; CHECK-NOT: .loc
|
||||
; CHECK: .loc 1 10 3 is_stmt 1
|
||||
;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
; CHECK: .loc 1 8 10
|
||||
; CHECK: callq bar
|
||||
; CHECK: [[TAIL]]:
|
||||
; CHECK: .loc 1 0 0
|
||||
; CHECK: .loc 1 0
|
||||
; CHECK: addl [[REG]], %eax
|
||||
; CHECK: .loc 1 9 3
|
||||
|
||||
|
|
Loading…
Reference in New Issue