[Debugify] Strip added metadata in the -debugify-each pipeline
Summary:
Share logic to strip debugify metadata between the IR and MIR level
debugify passes. This makes it simpler to hunt for bugs by diffing IR
with vs. without -debugify-each turned on.
As a drive-by, fix an issue causing CallGraphNodes to become invalid
when a dead llvm.dbg.value prototype is deleted.
Reviewers: dsanders, aprantl
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77915
diff --git a/llvm/test/DebugInfo/debugify-each.ll b/llvm/test/DebugInfo/debugify-each.ll
index e290b94..3fbb66d 100644
--- a/llvm/test/DebugInfo/debugify-each.ll
+++ b/llvm/test/DebugInfo/debugify-each.ll
@@ -18,19 +18,13 @@
; Check that stripped textual IR compares equal before and after applying
; debugify.
-; RUN: opt -O1 < %s -S -o - | \
-; RUN: opt -strip -strip-dead-prototypes -strip-named-metadata -S -o %t.before
-; RUN: opt -O1 -debugify-each < %s -S -o - | \
-; RUN: opt -strip -strip-dead-prototypes -strip-named-metadata -S -o %t.after
+; RUN: opt -O1 < %s -S -o %t.before
+; RUN: opt -O1 -debugify-each < %s -S -o %t.after
; RUN: diff %t.before %t.after
; Check that stripped IR compares equal before and after applying debugify.
-; RUN: opt -O1 < %s | \
-; RUN: opt -strip -strip-dead-prototypes -strip-named-metadata | \
-; RUN: llvm-dis -o %t.before
-; RUN: opt -O1 -debugify-each < %s | \
-; RUN: opt -strip -strip-dead-prototypes -strip-named-metadata | \
-; RUN: llvm-dis -o %t.after
+; RUN: opt -O1 < %s | llvm-dis -o %t.before
+; RUN: opt -O1 -debugify-each < %s | llvm-dis -o %t.after
; RUN: diff %t.before %t.after
define void @foo(i32 %arg) {