[PATCH] D98668: Support !heapallocsite attachments in StripTableDebugInfo().

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 15 16:26:13 PDT 2021


aprantl created this revision.
aprantl added a reviewer: vsk.
aprantl added a project: debug-info.
Herald added subscribers: dexonsmith, hiraditya.
aprantl requested review of this revision.
Herald added a project: LLVM.

They point into the DIType type system, so they need to be stripped as well.

      

rdar://75341300


https://reviews.llvm.org/D98668

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


Index: llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-heapallocsite.ll
===================================================================
--- llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-heapallocsite.ll
+++ llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-heapallocsite.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -S -strip-nonlinetable-debuginfo %s -o - |  FileCheck %s
+; RUN: opt -S -strip-debug %s -o - |  FileCheck %s
 ; int *get() { return new int[256]; }
 ; ModuleID = '/tmp/heapallocsite.cpp'
 source_filename = "/tmp/heapallocsite.cpp"
@@ -26,7 +27,7 @@
 !llvm.module.flags = !{!3, !4, !5, !6}
 !llvm.ident = !{!7}
 
-; CHECK-LABEL: !0 =
+; CHECK-LABEL: !llvm.ident
 ; CHECK-NOT: !DIBasicType(name: "int"
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (git at github.com:llvm/llvm-project 6d4ce49dae17715de502acbd50ab4c9b3c18215b)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None, sysroot: "/")
 !1 = !DIFile(filename: "/tmp/heapallocsite.cpp", directory: "/Volumes/Data/llvm-project")
Index: llvm/lib/IR/DebugInfo.cpp
===================================================================
--- llvm/lib/IR/DebugInfo.cpp
+++ llvm/lib/IR/DebugInfo.cpp
@@ -345,6 +345,9 @@
         if (NewLoopID != LoopID)
           I.setMetadata(LLVMContext::MD_loop, NewLoopID);
       }
+      // Strip heapallocsite attachments, they point into the DIType system.
+      if (I.hasMetadataOtherThanDebugLoc())
+        I.setMetadata("heapallocsite", nullptr);
     }
   }
   return Changed;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98668.330838.patch
Type: text/x-patch
Size: 1599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210315/f892c2f7/attachment.bin>


More information about the llvm-commits mailing list