From 7a725b21869ad0a38252c8a2f63f69dc2b4adf43 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 25 Sep 2018 17:29:30 +0000 Subject: [PATCH] Revert "[DebugInfo] Do not generate address info for removed debug labels." The added test is failing on macOS: http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/53550/ This reverts r342943. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342993 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 7 +++-- test/DebugInfo/Generic/debug-label-unreached.ll | 39 ------------------------- 2 files changed, 4 insertions(+), 42 deletions(-) delete mode 100644 test/DebugInfo/Generic/debug-label-unreached.ll diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 496c80a08e3..ee6821907b6 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -865,9 +865,10 @@ void DwarfCompileUnit::finishEntityDefinition(const DbgEntity *Entity) { llvm_unreachable("DbgEntity must be DbgVariable or DbgLabel."); } - if (Label) - if (const auto *Sym = Label->getSymbol()) - addLabelAddress(*Die, dwarf::DW_AT_low_pc, Sym); + if (Label) { + const MCSymbol *Sym = Label->getSymbol(); + addLabelAddress(*Die, dwarf::DW_AT_low_pc, Sym); + } } DbgEntity *DwarfCompileUnit::getExistingAbstractEntity(const DINode *Node) { diff --git a/test/DebugInfo/Generic/debug-label-unreached.ll b/test/DebugInfo/Generic/debug-label-unreached.ll deleted file mode 100644 index 3c56fe768db..00000000000 --- a/test/DebugInfo/Generic/debug-label-unreached.ll +++ /dev/null @@ -1,39 +0,0 @@ -; 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) -- 2.11.0