diff options
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 13 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/unknown-location.ll | 5 | ||||
-rw-r--r-- | llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll | 4 | ||||
-rw-r--r-- | llvm/test/DebugInfo/X86/tail-merge.ll | 2 |
4 files changed, 14 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 4ebc54555cc..3b67aa024f0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -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; } diff --git a/llvm/test/CodeGen/X86/unknown-location.ll b/llvm/test/CodeGen/X86/unknown-location.ll index b4c44fc3e46..3b90cf04b69 100644 --- a/llvm/test/CodeGen/X86/unknown-location.ll +++ b/llvm/test/CodeGen/X86/unknown-location.ll @@ -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 diff --git a/llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll b/llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll index 1230e97d803..c94f494e3e0 100644 --- a/llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll +++ b/llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll @@ -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 ; diff --git a/llvm/test/DebugInfo/X86/tail-merge.ll b/llvm/test/DebugInfo/X86/tail-merge.ll index cbdcf1ac29c..e0f86046305 100644 --- a/llvm/test/DebugInfo/X86/tail-merge.ll +++ b/llvm/test/DebugInfo/X86/tail-merge.ll @@ -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 |