[Debugify] Strip added metadata in the -debugify-each pipeline
authorVedant Kumar <vsk@apple.com>
Fri, 10 Apr 2020 21:58:13 +0000 (14:58 -0700)
committerVedant Kumar <vsk@apple.com>
Mon, 13 Apr 2020 17:55:17 +0000 (10:55 -0700)
commit122a6bfb07eb1ec7332ad1ee2e1a2136cc54a9c6
treed59a869b727a63f9004d8b36c42ec6b57ab8dae0
parent95e6f5c655fa39c26e4dc8d5ca65749af69cb484
[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
llvm/include/llvm/IR/IntrinsicInst.h
llvm/include/llvm/Transforms/Utils/Debugify.h
llvm/lib/Analysis/CallGraph.cpp
llvm/lib/CodeGen/MachineStripDebug.cpp
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/test/DebugInfo/debugify-each.ll