[llvm] r289256 - [DWARF] Suppress .loc directives from CFI instructions
Paul Robinson via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 11:15:33 PST 2016
Author: probinson
Date: Fri Dec 9 13:15:32 2016
New Revision: 289256
URL: http://llvm.org/viewvc/llvm-project?rev=289256&view=rev
Log:
[DWARF] Suppress .loc directives from CFI instructions
Like DBG_VALUE, these emit nothing to the .text section, and sometimes
have no source location specified. Just ignore them.
Differential Revision: http://reviews.llvm.org/D27492
Added:
llvm/trunk/test/DebugInfo/MIR/X86/no-cfi-loc.mir
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=289256&r1=289255&r2=289256&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Dec 9 13:15:32 2016
@@ -1006,8 +1006,8 @@ void DwarfDebug::beginInstruction(const
DebugHandlerBase::beginInstruction(MI);
assert(CurMI);
- // Check if source location changes, but ignore DBG_VALUE locations.
- if (MI->isDebugValue())
+ // Check if source location changes, but ignore DBG_VALUE and CFI locations.
+ if (MI->isDebugValue() || MI->isCFIInstruction())
return;
const DebugLoc &DL = MI->getDebugLoc();
if (DL == PrevInstLoc)
Added: llvm/trunk/test/DebugInfo/MIR/X86/no-cfi-loc.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/MIR/X86/no-cfi-loc.mir?rev=289256&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/MIR/X86/no-cfi-loc.mir (added)
+++ llvm/trunk/test/DebugInfo/MIR/X86/no-cfi-loc.mir Fri Dec 9 13:15:32 2016
@@ -0,0 +1,76 @@
+# Verify that a CFI instruction with no debug location
+# does not result in a line-0 location in the assembler.
+# RUN: %llc_dwarf -start-after=prologepilog -march=x86-64 -use-unknown-locations %s -o - | FileCheck %s
+#
+# CHECK-NOT: .loc 1 0
+# CHECK: .cfi_def_cfa_offset
+
+--- |
+ ; ModuleID = 'no-cfi-loc.ll'
+ source_filename = "no-cfi-loc.ll"
+ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+ define void @foo() !dbg !6 {
+ entry:
+ call void @bar(), !dbg !8
+ ret void, !dbg !9
+ }
+
+ declare void @bar()
+
+ ; Function Attrs: nounwind
+ declare void @llvm.stackprotector(i8*, i8**) #0
+
+ attributes #0 = { nounwind }
+
+ !llvm.dbg.cu = !{!0}
+ !llvm.module.flags = !{!3, !4}
+ !llvm.ident = !{!5}
+
+ !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 288778)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
+ !1 = !DIFile(filename: "t.c", directory: "/home/probinson/projects/scratch")
+ !2 = !{}
+ !3 = !{i32 2, !"Dwarf Version", i32 4}
+ !4 = !{i32 2, !"Debug Info Version", i32 3}
+ !5 = !{!"clang version 4.0.0 (trunk 288778)"}
+ !6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
+ !7 = !DISubroutineType(types: !2)
+ !8 = !DILocation(line: 3, column: 2, scope: !6)
+ !9 = !DILocation(line: 4, column: 1, scope: !6)
+
+...
+---
+name: foo
+alignment: 4
+exposesReturnsTwice: false
+legalized: false
+regBankSelected: false
+selected: false
+tracksRegLiveness: true
+calleeSavedRegisters: [ '%bh', '%bl', '%bp', '%bpl', '%bx', '%ebp', '%ebx',
+ '%rbp', '%rbx', '%r12', '%r13', '%r14', '%r15',
+ '%r12b', '%r13b', '%r14b', '%r15b', '%r12d', '%r13d',
+ '%r14d', '%r15d', '%r12w', '%r13w', '%r14w', '%r15w' ]
+frameInfo:
+ isFrameAddressTaken: false
+ isReturnAddressTaken: false
+ hasStackMap: false
+ hasPatchPoint: false
+ stackSize: 8
+ offsetAdjustment: 0
+ maxAlignment: 0
+ adjustsStack: true
+ hasCalls: true
+ maxCallFrameSize: 0
+ hasOpaqueSPAdjustment: false
+ hasVAStart: false
+ hasMustTailInVarArgFunc: false
+body: |
+ bb.0.entry:
+ frame-setup PUSH64r undef %rax, implicit-def %rsp, implicit %rsp, debug-location !8
+ CFI_INSTRUCTION def_cfa_offset 16
+ CALL64pcrel32 @bar, csr_64, implicit %rsp, implicit-def %rsp, debug-location !8
+ %rax = POP64r implicit-def %rsp, implicit %rsp, debug-location !9
+ RET 0, debug-location !9
+
+...
More information about the llvm-commits
mailing list