[llvm] c024f3e - Teach the stripNonLineTableDebugInfo pass about the llvm.dbg.addr intrinsic.
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 17:39:44 PDT 2020
Author: Adrian Prantl
Date: 2020-04-02T17:39:33-07:00
New Revision: c024f3ebdcfc9910d7d8f711a76d9dc669c9e97c
URL: https://github.com/llvm/llvm-project/commit/c024f3ebdcfc9910d7d8f711a76d9dc669c9e97c
DIFF: https://github.com/llvm/llvm-project/commit/c024f3ebdcfc9910d7d8f711a76d9dc669c9e97c.diff
LOG: Teach the stripNonLineTableDebugInfo pass about the llvm.dbg.addr intrinsic.
This patch also strips llvm.dbg.addr intrinsics when downgrading debug
info to linetables-only.
Differential Revision: https://reviews.llvm.org/D77343
Added:
Modified:
llvm/lib/IR/DebugInfo.cpp
llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-localvars.ll
Removed:
################################################################################
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index aaa8443769af..c0caab36bef4 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -606,6 +606,7 @@ bool llvm::stripNonLineTableDebugInfo(Module &M) {
Changed = true;
}
};
+ RemoveUses("llvm.dbg.addr");
RemoveUses("llvm.dbg.declare");
RemoveUses("llvm.dbg.value");
diff --git a/llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-localvars.ll b/llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-localvars.ll
index c2cb87acb2a0..c2642c312ccd 100644
--- a/llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-localvars.ll
+++ b/llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-localvars.ll
@@ -3,14 +3,18 @@
define void @f() !dbg !4 {
entry:
%i = alloca i32, align 4
- ; CHECK-NOT: llvm.dbg.declare
+ ; CHECK-NOT: llvm.dbg.{{addr|declare|value}}
call void @llvm.dbg.declare(metadata i32* %i, metadata !11, metadata !13), !dbg !14
+ call void @llvm.dbg.addr(metadata i32* %i, metadata !16, metadata !13), !dbg !14
store i32 42, i32* %i, align 4, !dbg !14
+ call void @llvm.dbg.value(metadata i32 0, metadata !16, metadata !13), !dbg !15
ret void, !dbg !15
}
; Function Attrs: nounwind readnone
+declare void @llvm.dbg.addr(metadata, metadata, metadata)
declare void @llvm.dbg.declare(metadata, metadata, metadata)
+declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!7, !8, !9}
@@ -22,6 +26,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
; CHECK: ![[F]] = distinct !DISubprogram(name: "f"
; CHECK-NOT: retainedNodes:
; CHECK-NOT: distinct !DISubprogram(name: "f"
+; CHECK-NOT: DILocalVariable
!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}
@@ -34,3 +39,4 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
!13 = !DIExpression()
!14 = !DILocation(line: 1, column: 16, scope: !4)
!15 = !DILocation(line: 1, column: 24, scope: !4)
+!16 = !DILocalVariable(name: "j", scope: !4, file: !1, line: 1, type: !12)
More information about the llvm-commits
mailing list