[PATCH] D26622: Linker: Remove unnecessary call to copyMetadata in IRLinker::linkGlobalVariable.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 12:30:00 PST 2016


pcc added inline comments.


================
Comment at: llvm/lib/Linker/IRMover.cpp:953
 void IRLinker::linkGlobalVariable(GlobalVariable &Dst, GlobalVariable &Src) {
-  Dst.copyMetadata(&Src, 0);
-
----------------
aprantl wrote:
> So, is the metadata attached to Dst always identical to the one in Src, or could there be a situation where one is more complete / otherwise better than the other?
As far as I know for our current uses of metadata on globals we only need to keep the metadata for whichever definition "wins". At this point `Dst` will always be a fresh global variable with metadata cloned from `Src`'s metadata, as far as I can tell from following the logic around IRLinker. The actual replacement of the definitions happens on line 943 after which we delete the old definition.


https://reviews.llvm.org/D26622





More information about the llvm-commits mailing list