+ // 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));
+