diff options
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()); |