diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-24 22:07:31 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-24 22:07:31 +0000 |
commit | c8d987b12194493d7634c3bde31b0d9340ceb3d2 (patch) | |
tree | 1f02fa0c89f9bf1de3f14f6e4af2d545df33da0d /llvm/lib/Linker/LinkModules.cpp | |
parent | 3d4cd756b6044837542acac3483e4cca7bc55814 (diff) | |
download | bcm5719-llvm-c8d987b12194493d7634c3bde31b0d9340ceb3d2.tar.gz bcm5719-llvm-c8d987b12194493d7634c3bde31b0d9340ceb3d2.zip |
Linker: Copy over function metadata attachments
Update `lib/Linker` to handle `Function` metadata attachments. The
attachments stick with the function body.
llvm-svn: 235786
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 65a02a71c70..34a353a6c82 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -1205,6 +1205,13 @@ bool ModuleLinker::linkFunctionBody(Function &Dst, Function &Src) { ++DI; } + // Copy over the metadata attachments. + SmallVector<std::pair<unsigned, MDNode *>, 8> MDs; + Src.getAllMetadata(MDs); + for (const auto &I : MDs) + Dst.setMetadata(I.first, MapMetadata(I.second, ValueMap, RF_None, &TypeMap, + &ValMaterializer)); + // Splice the body of the source function into the dest function. Dst.getBasicBlockList().splice(Dst.end(), Src.getBasicBlockList()); |