[llvm] c3a18bb - Support !heapallocsite attachments in StripDebugInfo().
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 16 10:05:45 PDT 2021
Author: Adrian Prantl
Date: 2021-03-16T10:05:13-07:00
New Revision: c3a18bb1e83149f38f0064f11a2ad97245a5848b
URL: https://github.com/llvm/llvm-project/commit/c3a18bb1e83149f38f0064f11a2ad97245a5848b
DIFF: https://github.com/llvm/llvm-project/commit/c3a18bb1e83149f38f0064f11a2ad97245a5848b.diff
LOG: Support !heapallocsite attachments in StripDebugInfo().
They point into the DIType type system, so they need to be stripped as well.
rdar://75341300
Differential Revision: https://reviews.llvm.org/D98668
Added:
Modified:
llvm/lib/IR/DebugInfo.cpp
llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-heapallocsite.ll
Removed:
################################################################################
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 381f13396dab..99349a304e30 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -345,6 +345,9 @@ bool llvm::stripDebugInfo(Function &F) {
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;
diff --git a/llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-heapallocsite.ll b/llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-heapallocsite.ll
index f99fb320a1fc..ceb18addace4 100644
--- a/llvm/test/Transforms/Util/strip-nonlinetable-debuginfo-heapallocsite.ll
+++ b/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 @@ attributes #2 = { builtin allocsize(0) }
!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")
More information about the llvm-commits
mailing list