[llvm] 9ee8d2e - [Debugify] Strip llvm.mir.debugify metadata
Anton Sidorenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 24 01:28:20 PST 2022
Author: Anton Sidorenko
Date: 2022-11-24T12:20:21+03:00
New Revision: 9ee8d2e081d2622b31e57154458b0317e437d98f
URL: https://github.com/llvm/llvm-project/commit/9ee8d2e081d2622b31e57154458b0317e437d98f
DIFF: https://github.com/llvm/llvm-project/commit/9ee8d2e081d2622b31e57154458b0317e437d98f.diff
LOG: [Debugify] Strip llvm.mir.debugify metadata
We don't strip llvm.mir.debugify metadata in `llvm::stripDebugifyMetadata`. This
may lead to incorrect number of lines and variables in the metadata when we run
debugify twice, e.g. -run-pass=mir-debugify,...,mir-strip-debug,...,mir-debugify.
Differential Revision: https://reviews.llvm.org/D138417
Added:
Modified:
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index f17d252f14b6..74ead37caf27 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -243,13 +243,18 @@ applyDebugify(Module &M,
bool llvm::stripDebugifyMetadata(Module &M) {
bool Changed = false;
- // Remove the llvm.debugify module-level named metadata.
+ // Remove the llvm.debugify and llvm.mir.debugify module-level named metadata.
NamedMDNode *DebugifyMD = M.getNamedMetadata("llvm.debugify");
if (DebugifyMD) {
M.eraseNamedMetadata(DebugifyMD);
Changed = true;
}
+ if (auto *MIRDebugifyMD = M.getNamedMetadata("llvm.mir.debugify")) {
+ M.eraseNamedMetadata(MIRDebugifyMD);
+ Changed = true;
+ }
+
// Strip out all debug intrinsics and supporting metadata (subprograms, types,
// variables, etc).
Changed |= StripDebugInfo(M);
diff --git a/llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir b/llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir
index 08f35c043934..59dcff9efd4d 100644
--- a/llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir
+++ b/llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir
@@ -27,7 +27,7 @@
; VALUE: [[VAR1:![0-9]+]] = !DILocalVariable(name: "1"
; VALUE: [[VAR2:![0-9]+]] = !DILocalVariable(name: "2"
; STRIP-NOT: !llvm.debugify
- ; STRIP: !llvm.mir.debugify
+ ; STRIP-NOT: !llvm.mir.debugify
...
---
More information about the llvm-commits
mailing list