Set the unnamed_addr only when we're creating a new GV in the dest module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128507 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2011-03-29 23:31:06 +00:00
parent 5f49c29612
commit 87fa8d12b4

View File

@ -505,6 +505,7 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
SGV->getType()->getAddressSpace()); SGV->getType()->getAddressSpace());
// Propagate alignment, visibility and section info. // Propagate alignment, visibility and section info.
CopyGVAttributes(NewDGV, SGV); CopyGVAttributes(NewDGV, SGV);
NewDGV->setUnnamedAddr(SGV->hasUnnamedAddr());
// If the LLVM runtime renamed the global, but it is an externally visible // If the LLVM runtime renamed the global, but it is an externally visible
// symbol, DGV must be an existing global with internal linkage. Rename // symbol, DGV must be an existing global with internal linkage. Rename