[PATCH] D46815: [DbgInfo] Fix StripDebugInfo
Son Tuan Vu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 18 09:20:00 PDT 2018
tyb0807 updated this revision to Diff 147532.
tyb0807 added a comment.
Sure, the patch is updated accordingly.
Thanks for the review!
https://reviews.llvm.org/D46815
Files:
lib/IR/DebugInfo.cpp
test/DebugInfo/strip-intrinsic-dbg.ll
Index: lib/IR/DebugInfo.cpp
===================================================================
--- lib/IR/DebugInfo.cpp
+++ lib/IR/DebugInfo.cpp
@@ -380,6 +380,16 @@
if (GVMaterializer *Materializer = M.getMaterializer())
Materializer->setStripDebugInfo();
+ StringRef DbgIntrinsics[] = {"llvm.dbg.value", "llvm.dbg.declare",
+ "llvm.dbg.addr", "llvm.dbg.label"};
+ for (StringRef FuncName : DbgIntrinsics) {
+ auto *F = M.getFunction(FuncName);
+ if (!F)
+ continue;
+ F->eraseFromParent();
+ Changed = true;
+ }
+
return Changed;
}
Index: test/DebugInfo/strip-intrinsic-dbg.ll
===================================================================
--- test/DebugInfo/strip-intrinsic-dbg.ll
+++ test/DebugInfo/strip-intrinsic-dbg.ll
@@ -0,0 +1,7 @@
+; RUN: opt -S -strip-debug <%s | FileCheck %s
+
+; CHECK-NOT: llvm.dbg.
+declare void @llvm.dbg.declare(metadata, metadata, metadata)
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+declare void @llvm.dbg.addr(metadata, metadata, metadata)
+declare void @llvm.dbg.label(metadata, metadata, metadata)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46815.147532.patch
Type: text/x-patch
Size: 1128 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180518/6f13e5b6/attachment.bin>
More information about the llvm-commits
mailing list