diff options
author | Stephen Tozer <stephen.tozer@sony.com> | 2022-01-18 11:11:57 +0000 |
---|---|---|
committer | Stephen Tozer <stephen.tozer@sony.com> | 2022-01-24 17:36:33 +0000 |
commit | ea17d29a6c834a34a698c87193a86eeab04922d2 (patch) | |
tree | 0ce5fcc52de9c067b63bf49c205e3e8ff4004129 /llvm/lib/IR/Constants.cpp | |
parent | 5fa40fb293241affeac45c9ec4e129e2280f7510 (diff) | |
download | llvm-ea17d29a6c834a34a698c87193a86eeab04922d2.zip llvm-ea17d29a6c834a34a698c87193a86eeab04922d2.tar.gz llvm-ea17d29a6c834a34a698c87193a86eeab04922d2.tar.bz2 |
[llvm] Do not replace dead constant references in metadata with undef
This patch removes an incorrect behaviour in Constants.cpp, which would
replace dead constant references in metadata with an undef value. This
blanket replacement resulted in undef values being inserted into
metadata that would not accept them. The replacement was intended for
debug info metadata, but this is now instead handled in the RAUW
handler.
Differential Revision: https://reviews.llvm.org/D117300
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index e031f88..c13990a 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -739,15 +739,8 @@ static bool constantIsDead(const Constant *C, bool RemoveDeadUsers) { ++I; } - if (RemoveDeadUsers) { - // If C is only used by metadata, it should not be preserved but should - // have its uses replaced. - if (C->isUsedByMetadata()) { - const_cast<Constant *>(C)->replaceAllUsesWith( - UndefValue::get(C->getType())); - } + if (RemoveDeadUsers) const_cast<Constant *>(C)->destroyConstant(); - } return true; } |