[llvm] r290012 - Allow "line 0" to be the first explicit debug location in a function.

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 15:54:34 PST 2016


Author: probinson
Date: Fri Dec 16 17:54:33 2016
New Revision: 290012

URL: http://llvm.org/viewvc/llvm-project?rev=290012&view=rev
Log:
Allow "line 0" to be the first explicit debug location in a function.

Feedback on r289468 from Adrian Prantl.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/test/DebugInfo/X86/dbg-prolog-end.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=290012&r1=290011&r2=290012&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Dec 16 17:54:33 2016
@@ -1063,7 +1063,7 @@ void DwarfDebug::beginInstruction(const
   // We have an explicit location, different from the previous location.
   // Don't repeat a line-0 record, but otherwise emit the new location.
   // (The new location might be an explicit line 0, which we do emit.)
-  if (DL.getLine() == 0 && LastAsmLine == 0)
+  if (PrevInstLoc && DL.getLine() == 0 && LastAsmLine == 0)
     return;
   unsigned Flags = 0;
   if (DL == PrologEndLoc) {

Modified: llvm/trunk/test/DebugInfo/X86/dbg-prolog-end.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-prolog-end.ll?rev=290012&r1=290011&r2=290012&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dbg-prolog-end.ll (original)
+++ llvm/trunk/test/DebugInfo/X86/dbg-prolog-end.ll Fri Dec 16 17:54:33 2016
@@ -2,6 +2,7 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
 target triple = "x86_64-apple-macosx10.6.7"
 
+;CHECK-LABEL: foo:
 ;CHECK: .loc	1 2 11 prologue_end
 define i32 @foo(i32 %i) nounwind ssp !dbg !1 {
 entry:
@@ -24,10 +25,13 @@ entry:
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 
+;CHECK-LABEL: main:
+;CHECK: .loc 1 0 0 prologue_end
+
 define i32 @main() nounwind ssp !dbg !6 {
 entry:
   %retval = alloca i32, align 4
-  store i32 0, i32* %retval
+  store i32 0, i32* %retval, !dbg !22
   %call = call i32 @foo(i32 21), !dbg !16
   ret i32 %call, !dbg !16
 }
@@ -57,3 +61,4 @@ entry:
 !19 = !DIFile(filename: "/tmp/a.c", directory: "/private/tmp")
 !20 = !{}
 !21 = !{i32 1, !"Debug Info Version", i32 3}
+!22 = !DILocation(line: 0, column: 0, scope: !17)




More information about the llvm-commits mailing list