diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index d82f513..7b95ac0 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -950,8 +950,9 @@ void Mapper::remapFunction(Function &F) { // Remap the metadata attachments. SmallVector<std::pair<unsigned, MDNode *>, 8> MDs; F.getAllMetadata(MDs); + F.clearMetadata(); for (const auto &I : MDs) - F.setMetadata(I.first, cast_or_null<MDNode>(mapMetadata(I.second))); + F.addMetadata(I.first, *cast<MDNode>(mapMetadata(I.second))); // Remap the argument types. if (TypeMapper) |