diff options
author | Stephen Tozer <stephen.tozer@sony.com> | 2024-02-27 08:24:13 +0000 |
---|---|---|
committer | Stephen Tozer <stephen.tozer@sony.com> | 2024-02-27 09:59:08 +0000 |
commit | aa436493ab7ad4cf323b0189c15c59ac9dc293c7 (patch) | |
tree | e284c6a08671928ec7cc22c8a4b4b700eb1fcd34 /llvm/lib/IR/Module.cpp | |
parent | ada70f50a5591839d0c81a167ca64ce98ab2d088 (diff) | |
download | llvm-aa436493ab7ad4cf323b0189c15c59ac9dc293c7.zip llvm-aa436493ab7ad4cf323b0189c15c59ac9dc293c7.tar.gz llvm-aa436493ab7ad4cf323b0189c15c59ac9dc293c7.tar.bz2 |
Reapply "[RemoveDIs] Print non-intrinsic debug info in textual IR output (#79281)"
Fixes the prior issue in which the symbol for a cl-arg was unavailable to
some binaries.
This reverts commit dc06d75ab27b4dcae2940fc386fadd06f70faffe.
Diffstat (limited to 'llvm/lib/IR/Module.cpp')
-rw-r--r-- | llvm/lib/IR/Module.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index 1946db2..a8696ed 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -85,6 +85,28 @@ Module::~Module() { IFuncList.clear(); } +void Module::removeDebugIntrinsicDeclarations() { + auto *DeclareIntrinsicFn = + Intrinsic::getDeclaration(this, Intrinsic::dbg_declare); + assert((!isMaterialized() || DeclareIntrinsicFn->hasZeroLiveUses()) && + "Debug declare intrinsic should have had uses removed."); + DeclareIntrinsicFn->eraseFromParent(); + auto *ValueIntrinsicFn = + Intrinsic::getDeclaration(this, Intrinsic::dbg_value); + assert((!isMaterialized() || ValueIntrinsicFn->hasZeroLiveUses()) && + "Debug value intrinsic should have had uses removed."); + ValueIntrinsicFn->eraseFromParent(); + auto *AssignIntrinsicFn = + Intrinsic::getDeclaration(this, Intrinsic::dbg_assign); + assert((!isMaterialized() || AssignIntrinsicFn->hasZeroLiveUses()) && + "Debug assign intrinsic should have had uses removed."); + AssignIntrinsicFn->eraseFromParent(); + auto *LabelntrinsicFn = Intrinsic::getDeclaration(this, Intrinsic::dbg_label); + assert((!isMaterialized() || LabelntrinsicFn->hasZeroLiveUses()) && + "Debug label intrinsic should have had uses removed."); + LabelntrinsicFn->eraseFromParent(); +} + std::unique_ptr<RandomNumberGenerator> Module::createRNG(const StringRef Name) const { SmallString<32> Salt(Name); |