forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DwarfDebug: Pick next location in case of missing location at block b…
…egin Context: Compiler generated instructions do not have a debug location assigned to them. However emitting 0-line records for all of them bloats the line tables for very little benefit so we usually avoid doing that. Not emitting anything will lead to the previous debug location getting applied to the locationless instructions. This is not desirable for block begin and after labels. Previously we would emit simply emit line-0 records in this case, this patch changes the behavior to do a forward search for a debug location in these cases before emitting a line-0 record to further reduce line table bloat. Inspired by the discussion in https://reviews.llvm.org/D52862 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343874 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
8 changed files
with
157 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# RUN: llc -o - %s -start-before=patchable-function -use-unknown-locations=Default | FileCheck %s --check-prefixes=CHECK,DEFAULT | ||
# RUN: llc -o - %s -start-before=patchable-function -use-unknown-locations=Enable | FileCheck %s --check-prefixes=CHECK,ENABLE | ||
# RUN: llc -o - %s -start-before=patchable-function -use-unknown-locations=Disable | FileCheck %s --check-prefixes=CHECK,DISABLE | ||
--- | | ||
target triple = "x86_64--" | ||
|
||
!0 = !DIFile(filename: "dwarf-no-source-loc.mir", directory: "/") | ||
!1 = distinct !DICompileUnit(file: !0, language: DW_LANG_C, emissionKind: LineTablesOnly) | ||
!2 = distinct !DISubprogram(name: "func", unit: !1) | ||
!3 = !DILocation(line: 17, scope: !2) | ||
!4 = !DILocation(line: 42, scope: !2) | ||
|
||
!llvm.dbg.cu = !{!1} | ||
!llvm.module.flags = !{!10, !11} | ||
!10 = !{i32 2, !"Dwarf Version", i32 4} | ||
!11 = !{i32 2, !"Debug Info Version", i32 3} | ||
|
||
define void @func() !dbg !2 { | ||
unreachable | ||
} | ||
... | ||
--- | ||
name: func | ||
body: | | ||
bb.0: | ||
NOOP | ||
NOOP | ||
$eax = MOV32ri 1, debug-location !3 | ||
; CHECK-LABEL: bb.0 | ||
; CHECK: nop | ||
; CHECK: nop | ||
; CHECK: .loc 1 17 0 prologue_end | ||
; CHECK: movl $1, %eax | ||
bb.1: | ||
NOOP | ||
$ebx = MOV32ri 2, debug-location !4 | ||
; CHECK-LABEL: bb.1 | ||
; DEFAULT: .loc 1 42 0 | ||
; ENABLE: .loc 1 0 | ||
; DISABLE-NOT: .loc 1 0 | ||
; CHECK: nop | ||
; ENABLE: .loc 1 42 0 | ||
; CHECK: movl $2, %ebx | ||
bb.2: | ||
NOOP | ||
; CHECK-LABEL: bb.2 | ||
; DEFAULT: .loc 1 0 0 is_stmt 0 | ||
; ENABLE: .loc 1 0 0 is_stmt 0 | ||
; DISABLE-NOT: .loc 1 0 | ||
; CHECK: nop | ||
bb.3: | ||
NOOP | ||
$ecx = MOV32ri 3, debug-location !3 | ||
; CHECK-LABEL: bb.3 | ||
; CHECK: nop | ||
; DEFAULT: .loc 1 17 0 is_stmt 1 | ||
; ENABLE: .loc 1 17 0 is_stmt 1 | ||
; DISABLE-NOT: .loc 1 0 | ||
; CHECK: movl $3, %ecx | ||
bb.4: | ||
NOOP | ||
$edx = MOV32ri 4, debug-location !4 | ||
; CHECK: bb.4 | ||
; DEFAULT: .loc 1 42 0 | ||
; ENABLE: .loc 1 0 0 is_stmt 0 | ||
; DISABLE-NOT: .loc 1 0 | ||
; CHECK: nop | ||
; ENABLE: .loc 1 42 0 is_stmt 1 | ||
; CHECK: movl $4, %edx | ||
... |