diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-12-01 22:40:40 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-12-01 22:40:40 +0000 |
commit | e39cd5b14467f79e85512b5aa55da6f078910e92 (patch) | |
tree | e9a7fe388456f43b2bc5852ff5d8a8edbf619bf6 | |
parent | 9de8fc57662a6e4833ebcadf08ba757a97d73f4e (diff) | |
download | bcm5719-llvm-e39cd5b14467f79e85512b5aa55da6f078910e92.tar.gz bcm5719-llvm-e39cd5b14467f79e85512b5aa55da6f078910e92.zip |
Pass down the dst GV to linkGlobalValueBody. NFC.
llvm-svn: 254465
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 3c6d6f067c4..271c765d63c 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -527,7 +527,7 @@ private: void linkGlobalInit(GlobalVariable &Dst, GlobalVariable &Src); bool linkFunctionBody(Function &Dst, Function &Src); void linkAliasBody(GlobalAlias &Dst, GlobalAlias &Src); - bool linkGlobalValueBody(GlobalValue &Src); + bool linkGlobalValueBody(GlobalValue &Dst, GlobalValue &Src); /// Functions that take care of cloning a specific global value type /// into the destination module. @@ -924,7 +924,7 @@ void ModuleLinker::materializeInitFor(GlobalValue *New, GlobalValue *Old) { if (!New->hasLocalLinkage() && DoNotLinkFromSource.count(Old)) return; - linkGlobalValueBody(*Old); + linkGlobalValueBody(*New, *Old); } bool ModuleLinker::getComdatLeader(Module &M, StringRef ComdatName, @@ -1566,9 +1566,7 @@ void ModuleLinker::linkAliasBody(GlobalAlias &Dst, GlobalAlias &Src) { Dst.setAliasee(Val); } -bool ModuleLinker::linkGlobalValueBody(GlobalValue &Src) { - Value *Dst = ValueMap[&Src]; - assert(Dst); +bool ModuleLinker::linkGlobalValueBody(GlobalValue &Dst, GlobalValue &Src) { if (const Comdat *SC = Src.getComdat()) { // To ensure that we don't generate an incomplete comdat group, // we must materialize and map in any other members that are not @@ -1583,15 +1581,15 @@ bool ModuleLinker::linkGlobalValueBody(GlobalValue &Src) { } } if (shouldInternalizeLinkedSymbols()) - if (auto *DGV = dyn_cast<GlobalValue>(Dst)) + if (auto *DGV = dyn_cast<GlobalValue>(&Dst)) DGV->setLinkage(GlobalValue::InternalLinkage); if (auto *F = dyn_cast<Function>(&Src)) - return linkFunctionBody(cast<Function>(*Dst), *F); + return linkFunctionBody(cast<Function>(Dst), *F); if (auto *GVar = dyn_cast<GlobalVariable>(&Src)) { - linkGlobalInit(cast<GlobalVariable>(*Dst), *GVar); + linkGlobalInit(cast<GlobalVariable>(Dst), *GVar); return false; } - linkAliasBody(cast<GlobalAlias>(*Dst), cast<GlobalAlias>(Src)); + linkAliasBody(cast<GlobalAlias>(Dst), cast<GlobalAlias>(Src)); return false; } |