diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-12-05 15:42:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-12-05 15:42:30 +0000 |
commit | ad9d0ca878b5513c35ba1174b083dffe6e811463 (patch) | |
tree | 2b9fd9e0cae003a8b57a90d0d760416ae6618029 /llvm/lib/Linker/LinkModules.cpp | |
parent | 362d1202e231d86784e30c61ee7d3a20063c3426 (diff) | |
download | bcm5719-llvm-ad9d0ca878b5513c35ba1174b083dffe6e811463.tar.gz bcm5719-llvm-ad9d0ca878b5513c35ba1174b083dffe6e811463.zip |
Use an early return. NFC.
llvm-svn: 223470
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 5b2d425c805..561b02136b8 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -1028,30 +1028,30 @@ bool ModuleLinker::linkGlobalValueProto(GlobalValue *SGV) { else NewGV = linkGlobalAliasProto(cast<GlobalAlias>(SGV), DGV, LinkFromSrc); - if (NewGV) { - if (NewGV != DGV) - copyGVAttributes(NewGV, SGV); + if (!NewGV) + return false; - NewGV->setUnnamedAddr(HasUnnamedAddr); - NewGV->setVisibility(Visibility); + if (NewGV != DGV) + copyGVAttributes(NewGV, SGV); - if (auto *NewGO = dyn_cast<GlobalObject>(NewGV)) { - if (C) - NewGO->setComdat(C); + NewGV->setUnnamedAddr(HasUnnamedAddr); + NewGV->setVisibility(Visibility); - if (DGV && DGV->hasCommonLinkage() && SGV->hasCommonLinkage()) - NewGO->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment())); - } + if (auto *NewGO = dyn_cast<GlobalObject>(NewGV)) { + if (C) + NewGO->setComdat(C); - // Make sure to remember this mapping. - if (NewGV != DGV) { - if (DGV) { - DGV->replaceAllUsesWith( - ConstantExpr::getBitCast(NewGV, DGV->getType())); - DGV->eraseFromParent(); - } - ValueMap[SGV] = NewGV; + if (DGV && DGV->hasCommonLinkage() && SGV->hasCommonLinkage()) + NewGO->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment())); + } + + // Make sure to remember this mapping. + if (NewGV != DGV) { + if (DGV) { + DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewGV, DGV->getType())); + DGV->eraseFromParent(); } + ValueMap[SGV] = NewGV; } return false; |