diff options
author | Hsiangkai Wang <hsiangkai@gmail.com> | 2018-09-25 06:09:50 +0000 |
---|---|---|
committer | Hsiangkai Wang <hsiangkai@gmail.com> | 2018-09-25 06:09:50 +0000 |
commit | 9c2463622dd58b6b3987fe80509c22f5df02b88c (patch) | |
tree | 9f0de954cf460fe6fcebef1c686eda02b5c0c05a /llvm/test/DebugInfo/Generic | |
parent | e15248362352c549561cda871bd952842e1db620 (diff) | |
download | bcm5719-llvm-9c2463622dd58b6b3987fe80509c22f5df02b88c.tar.gz bcm5719-llvm-9c2463622dd58b6b3987fe80509c22f5df02b88c.zip |
[DebugInfo] Do not generate address info for removed debug labels.
In some senario, LLVM will remove llvm.dbg.labels in IR. For example,
when the labels are in unreachable blocks, these labels will not
be generated in LLVM IR. In the case, these debug labels will have
address zero as their address. It is not legal address for debugger to
set breakpoints or query sources. So, the patch inhibits the address info
(DW_AT_low_pc) of removed labels.
Differential Revision: https://reviews.llvm.org/D51908
llvm-svn: 342943
Diffstat (limited to 'llvm/test/DebugInfo/Generic')
-rw-r--r-- | llvm/test/DebugInfo/Generic/debug-label-unreached.ll | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/test/DebugInfo/Generic/debug-label-unreached.ll b/llvm/test/DebugInfo/Generic/debug-label-unreached.ll new file mode 100644 index 00000000000..3c56fe768db --- /dev/null +++ b/llvm/test/DebugInfo/Generic/debug-label-unreached.ll @@ -0,0 +1,39 @@ +; Test unreachable llvm.dbg.label +; +; RUN: llc -filetype=obj -split-dwarf-file debug.dwo -o - %s | llvm-dwarfdump -v - | FileCheck %s +; +; CHECK: .debug_info.dwo contents: +; CHECK: DW_TAG_label +; CHECK-NEXT: DW_AT_name {{.*}}"done" +; CHECK-NOT: {{DW_TAG|NULL}} +; CHECK: DW_AT_low_pc +; CHECK: DW_TAG_label +; CHECK-NEXT: DW_AT_name {{.*}}"removed" +; CHECK-NOT: DW_AT_low_pc +source_filename = "debug-label-unreached.c" + +define dso_local i32 @foo(i32 %a, i32 %b) !dbg !8 { +entry: + %sum = add nsw i32 %a, %b, !dbg !12 + call void @llvm.dbg.label(metadata !11), !dbg !12 + ret i32 %sum, !dbg !13 +} + +declare void @llvm.dbg.label(metadata) + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!4} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, emissionKind: FullDebug, enums: !2) +!1 = !DIFile(filename: "debug-label-unreached.c", directory: "./") +!2 = !{} +!4 = !{i32 2, !"Debug Info Version", i32 3} +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !9) +!9 = !{!10, !11} +!10 = !DILabel(scope: !8, name: "removed", file: !1, line: 11) +!11 = !DILabel(scope: !8, name: "done", file: !1, line: 13) +!12 = !DILocation(line: 13, column: 1, scope: !8) +!13 = !DILocation(line: 14, column: 5, scope: !8) |