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

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 14:53:32 PST 2016


> On 2016-Nov-14, at 12:30, Peter Collingbourne <peter at pcc.me.uk> wrote:
> 
> 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.
> 

Making the metadata that's attached to the chosen definition "win" makes sense to me.

> 
> https://reviews.llvm.org/D26622
> 
> 
> 



More information about the llvm-commits mailing list