diff options
| author | Paul Robinson <paul.robinson@sony.com> | 2016-11-29 22:41:16 +0000 |
|---|---|---|
| committer | Paul Robinson <paul.robinson@sony.com> | 2016-11-29 22:41:16 +0000 |
| commit | 96de8c778bb954d01a10ce1251f6b52e89018698 (patch) | |
| tree | 5e24997c148e2282cea951bcbf6c797310a5af8a /llvm/test | |
| parent | 17062a2bf6159649cab8fabf843e352e79ee77c5 (diff) | |
| download | bcm5719-llvm-96de8c778bb954d01a10ce1251f6b52e89018698.tar.gz bcm5719-llvm-96de8c778bb954d01a10ce1251f6b52e89018698.zip | |
Emit 'no line' information for interesting 'orphan' instructions.
DWARF specifies that "line 0" really means "no appropriate source
location" in the line table. Use this for branch targets and some
other cases that have no specified source location, to prevent
inheriting unfortunate line numbers from physically preceding
instructions (which might be from completely unrelated source).
Differential Revision: http://reviews.llvm.org/D24180
llvm-svn: 288212
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/X86/stack-protector.ll | 15 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/AArch64/line-header.ll | 2 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll | 74 |
3 files changed, 85 insertions, 6 deletions
diff --git a/llvm/test/CodeGen/X86/stack-protector.ll b/llvm/test/CodeGen/X86/stack-protector.ll index d3ff61743ed..5166ed5b02a 100644 --- a/llvm/test/CodeGen/X86/stack-protector.ll +++ b/llvm/test/CodeGen/X86/stack-protector.ll @@ -3888,23 +3888,27 @@ entry: define void @test32() #1 !dbg !7 { entry: ; LINUX-I386-LABEL: test32: -; LINUX-I386: .loc 1 0 0 prologue_end +; LINUX-I386: .loc 1 4 2 prologue_end +; LINUX-I386: .loc 1 0 0 ; LINUX-I386-NEXT: calll __stack_chk_fail ; LINUX-X64-LABEL: test32: -; LINUX-X64: .loc 1 0 0 prologue_end +; LINUX-X64: .loc 1 4 2 prologue_end +; LINUX-X64: .loc 1 0 0 ; LINUX-X64-NEXT: callq __stack_chk_fail ; LINUX-KERNEL-X64-LABEL: test32: -; LINUX-KERNEL-X64: .loc 1 0 0 prologue_end +; LINUX-KERNEL-X64: .loc 1 4 2 prologue_end +; LINUX-KERNEL-X64: .loc 1 0 0 ; LINUX-KERNEL-X64-NEXT: callq __stack_chk_fail ; OPENBSD-AMD64-LABEL: test32: -; OPENBSD-AMD64: .loc 1 0 0 prologue_end +; OPENBSD-AMD64: .loc 1 4 2 prologue_end +; OPENBSD-AMD64: .loc 1 0 0 ; OPENBSD-AMD64-NEXT: movl ; OPENBSD-AMD64-NEXT: callq __stack_smash_handler %0 = alloca [5 x i8], align 1 - ret void + ret void, !dbg !9 } declare double @testi_aux() @@ -3940,3 +3944,4 @@ attributes #5 = { ssp "stack-protector-buffer-size"="6" } !6 = distinct !DISubprogram(name: "__stack_chk_fail", scope: !1, type: !8, unit: !0) !7 = distinct !DISubprogram(name: "test32", scope: !1, type: !8, unit: !0) !8 = !DISubroutineType(types: !2) +!9 = !DILocation(line: 4, column: 2, scope: !7) diff --git a/llvm/test/DebugInfo/AArch64/line-header.ll b/llvm/test/DebugInfo/AArch64/line-header.ll index f8220233faa..38d06f263e2 100644 --- a/llvm/test/DebugInfo/AArch64/line-header.ll +++ b/llvm/test/DebugInfo/AArch64/line-header.ll @@ -3,4 +3,4 @@ ; check line table length is correctly calculated for both big and little endian CHECK-LABEL: .debug_line contents: -CHECK: total_length: 0x0000003c +CHECK: total_length: 0x0000003e diff --git a/llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll b/llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll new file mode 100644 index 00000000000..d71f95d999e --- /dev/null +++ b/llvm/test/DebugInfo/X86/dwarf-no-source-loc.ll @@ -0,0 +1,74 @@ +; Verify "no source location" directives appear in appropriate places. +; RUN: llc %s -o - | FileCheck %s + +; Generated from this .cpp targeting linux using -g +; and then removed function attributes as clutter. +; +; void bar(int *); +; void baz(int *); +; # 5 "no-source-loc.cpp" +; void foo(int x) { +; int z; +; if (x) +; # 20 "include.h" +; bar(&z); +; # 10 "no-source-loc.cpp" +; baz(&z); +; } + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; Function Attrs: uwtable +define void @_Z3fooi(i32 %x) !dbg !6 { +entry: + %x.addr = alloca i32, align 4 + %z = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %0 = load i32, i32* %x.addr, align 4, !dbg !8 + %tobool = icmp ne i32 %0, 0, !dbg !8 + br i1 %tobool, label %if.then, label %if.end, !dbg !8 + +if.then: ; preds = %entry + call void @_Z3barPi(i32* %z), !dbg !9 + br label %if.end, !dbg !9 + +if.end: ; preds = %if.then, %entry + call void @_Z3bazPi(i32* %z), !dbg !12 + ret void, !dbg !14 +} + +; CHECK: .loc 1 7 7 +; CHECK-NOT: .loc +; CHECK: .loc 1 0 0 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-NOT: .loc +; CHECK: .loc 1 10 3 is_stmt 1 + + +declare void @_Z3barPi(i32*) + +declare void @_Z3bazPi(i32*) + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!3, !4} +!llvm.ident = !{!5} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0 (trunk 278782)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2) +!1 = !DIFile(filename: "no-source-loc.cpp", directory: "/tests") +!2 = !{} +!3 = !{i32 2, !"Dwarf Version", i32 4} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !{!"clang version 4.0.0 (trunk 278782)"} +!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 5, type: !7, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) +!7 = !DISubroutineType(types: !2) +!8 = !DILocation(line: 7, column: 7, scope: !6) +!9 = !DILocation(line: 20, column: 5, scope: !10) +!10 = !DILexicalBlockFile(scope: !6, file: !11, discriminator: 0) +!11 = !DIFile(filename: "include.h", directory: "/tests") +!12 = !DILocation(line: 10, column: 3, scope: !13) +!13 = !DILexicalBlockFile(scope: !6, file: !1, discriminator: 0) +!14 = !DILocation(line: 11, column: 1, scope: !13) |

