From 46cbde27ce8452261d325b109827b37516b8cf2a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 5 Dec 2014 15:42:30 +0000 Subject: [PATCH] Use an early return. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223470 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Linker/LinkModules.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 5b2d425c805..561b02136b8 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -1028,30 +1028,30 @@ bool ModuleLinker::linkGlobalValueProto(GlobalValue *SGV) { else NewGV = linkGlobalAliasProto(cast(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(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(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; -- 2.11.0