aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CloneFunction.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/CloneFunction.cpp
parent09ec5756dc7d92c3a2f91313736c157bf3ffd848 (diff)
downloadllvm-382d81cacf066452b98128b680f0988e5bda89a8.zip
llvm-382d81cacf066452b98128b680f0988e5bda89a8.tar.gz
llvm-382d81cacf066452b98128b680f0988e5bda89a8.tar.bz2
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/CloneFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 24f7d69..b64fdbd7 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -122,11 +122,11 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
SmallVector<std::pair<unsigned, MDNode *>, 1> MDs;
OldFunc->getAllMetadata(MDs);
for (auto MD : MDs)
- NewFunc->setMetadata(
+ NewFunc->addMetadata(
MD.first,
- MapMetadata(MD.second, VMap,
- ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges,
- TypeMapper, Materializer));
+ *MapMetadata(MD.second, VMap,
+ ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges,
+ TypeMapper, Materializer));
// Loop over all of the basic blocks in the function, cloning them as
// appropriate. Note that we save BE this way in order to handle cloning of