[PATCH] D77345: Teach the stripNonLineTableDebugInfo pass about the llvm.dbg.label intrinsic.

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 16:17:56 PDT 2020


aprantl created this revision.
aprantl added reviewers: steven_wu, vsk, friss, davide.
aprantl added a project: debug-info.
Herald added subscribers: dexonsmith, hiraditya.
vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

LGTM


Debug info for labels is not generated at -gline-tables-only, so this pass should remove them.


https://reviews.llvm.org/D77345

Files:
  llvm/lib/IR/DebugInfo.cpp
  llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-labels.ll


Index: llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-labels.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-labels.ll
@@ -0,0 +1,28 @@
+; RUN: opt -S -strip-nonlinetable-debuginfo %s -o - | FileCheck %s
+; CHECK: define void @f()
+define void @f() !dbg !4 {
+entry:
+; CHECK-NOT: llvm.dbg.label
+  call void @llvm.dbg.label(metadata !12), !dbg !11
+  ret void, !dbg !11
+}
+
+declare void @llvm.dbg.label(metadata)
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!7, !8, !9}
+!llvm.ident = !{!10}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "LLVM", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2)
+!1 = !DIFile(filename: "f.c", directory: "/")
+!2 = !{}
+!4 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, retainedNodes: !2)
+!5 = !DISubroutineType(types: !6)
+!6 = !{null}
+!7 = !{i32 2, !"Dwarf Version", i32 2}
+!8 = !{i32 2, !"Debug Info Version", i32 3}
+!9 = !{i32 1, !"PIC Level", i32 2}
+!10 = !{!"LLVM"}
+!11 = !DILocation(line: 1, column: 24, scope: !4)
+; CHECK-NOT: DILabel
+!12 = !DILabel(scope: !4, name: "entry", file: !1, line: 1)
Index: llvm/lib/IR/DebugInfo.cpp
===================================================================
--- llvm/lib/IR/DebugInfo.cpp
+++ llvm/lib/IR/DebugInfo.cpp
@@ -608,6 +608,7 @@
   };
   RemoveUses("llvm.dbg.addr");
   RemoveUses("llvm.dbg.declare");
+  RemoveUses("llvm.dbg.label");
   RemoveUses("llvm.dbg.value");
 
   // Delete non-CU debug info named metadata nodes.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77345.254642.patch
Type: text/x-patch
Size: 1685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200402/cb7a133c/attachment.bin>


More information about the llvm-commits mailing list