[PATCH] D46815: [DbgInfo] Fix StripDebugInfo

Son Tuan Vu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 02:23:16 PDT 2018


tyb0807 updated this revision to Diff 147018.
tyb0807 marked 2 inline comments as done.
tyb0807 added a comment.

Addressed review comments. Thank you for the help


https://reviews.llvm.org/D46815

Files:
  lib/IR/DebugInfo.cpp
  test/DebugInfo/strip-intrinsic-dbg.ll
  tools/opt/opt.cpp


Index: lib/IR/DebugInfo.cpp
===================================================================
--- lib/IR/DebugInfo.cpp
+++ lib/IR/DebugInfo.cpp
@@ -382,0 +383,10 @@
+  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;
+  }
+
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)
Index: tools/opt/opt.cpp
===================================================================
--- tools/opt/opt.cpp
+++ tools/opt/opt.cpp
@@ -759 +759 @@
-    Passes.add(createCheckDebugifyModulePass(false));
+    Passes.add(createCheckDebugifyModulePass(StripDebug));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46815.147018.patch
Type: text/x-patch
Size: 1271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180516/23f213b3/attachment.bin>


More information about the llvm-commits mailing list