aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Constants.cpp
diff options
context:
space:
mode:
authorYASHASVI KHATAVKAR <yashasvi.khatavkar@intel.com>2022-04-25 20:46:14 -0400
committerYASHASVI KHATAVKAR <yashasvi.khatavkar@intel.com>2022-04-25 20:50:00 -0400
commite83543f8c2ef79f82f2e291072a956e23ab08efa (patch)
treee90d0a8f70be2067b8ae395036f2796edc9b8277 /llvm/lib/IR/Constants.cpp
parent8e4cd7295cb56c2baa6fbed1b739ed974738c307 (diff)
downloadllvm-e83543f8c2ef79f82f2e291072a956e23ab08efa.zip
llvm-e83543f8c2ef79f82f2e291072a956e23ab08efa.tar.gz
llvm-e83543f8c2ef79f82f2e291072a956e23ab08efa.tar.bz2
Don't replace Undef with null value for Constants Differential Revision:https://reviews.llvm.org/D124098
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index 1a7c9d3..5dcf1ba 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -741,9 +741,13 @@ static bool constantIsDead(const Constant *C, bool RemoveDeadUsers) {
++I;
}
- if (RemoveDeadUsers)
+ if (RemoveDeadUsers) {
+ // If C is only used by metadata, it should not be preserved but should
+ // have its uses replaced.
+ ReplaceableMetadataImpl::SalvageDebugInfo(*C);
const_cast<Constant *>(C)->destroyConstant();
-
+ }
+
return true;
}