summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/ValueMapper.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-06-01 01:17:57 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-06-01 01:17:57 +0000
commit382d81cacf066452b98128b680f0988e5bda89a8 (patch)
tree1d50935b001bb7b52b70a6a9d87e0b3139b82292 /llvm/lib/Transforms/Utils/ValueMapper.cpp
parent09ec5756dc7d92c3a2f91313736c157bf3ffd848 (diff)
downloadbcm5719-llvm-382d81cacf066452b98128b680f0988e5bda89a8.tar.gz
bcm5719-llvm-382d81cacf066452b98128b680f0988e5bda89a8.zip
IR: Allow multiple global metadata attachments with the same type.
This will be necessary to allow the global merge pass to attach multiple debug info metadata nodes to global variables once we reverse the edge from DIGlobalVariable to GlobalVariable. Differential Revision: http://reviews.llvm.org/D20414 llvm-svn: 271358
Diffstat (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/ValueMapper.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index d82f513419f..7b95ac04b5f 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)
OpenPOWER on IntegriCloud