Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Commit 46cbde2

Browse files
committed
Use an early return. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223470 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent c4c08aa commit 46cbde2

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

lib/Linker/LinkModules.cpp

+19-19
Original file line numberDiff line numberDiff line change
@@ -1028,30 +1028,30 @@ bool ModuleLinker::linkGlobalValueProto(GlobalValue *SGV) {
10281028
else
10291029
NewGV = linkGlobalAliasProto(cast<GlobalAlias>(SGV), DGV, LinkFromSrc);
10301030

1031-
if (NewGV) {
1032-
if (NewGV != DGV)
1033-
copyGVAttributes(NewGV, SGV);
1031+
if (!NewGV)
1032+
return false;
10341033

1035-
NewGV->setUnnamedAddr(HasUnnamedAddr);
1036-
NewGV->setVisibility(Visibility);
1034+
if (NewGV != DGV)
1035+
copyGVAttributes(NewGV, SGV);
10371036

1038-
if (auto *NewGO = dyn_cast<GlobalObject>(NewGV)) {
1039-
if (C)
1040-
NewGO->setComdat(C);
1037+
NewGV->setUnnamedAddr(HasUnnamedAddr);
1038+
NewGV->setVisibility(Visibility);
10411039

1042-
if (DGV && DGV->hasCommonLinkage() && SGV->hasCommonLinkage())
1043-
NewGO->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment()));
1044-
}
1040+
if (auto *NewGO = dyn_cast<GlobalObject>(NewGV)) {
1041+
if (C)
1042+
NewGO->setComdat(C);
10451043

1046-
// Make sure to remember this mapping.
1047-
if (NewGV != DGV) {
1048-
if (DGV) {
1049-
DGV->replaceAllUsesWith(
1050-
ConstantExpr::getBitCast(NewGV, DGV->getType()));
1051-
DGV->eraseFromParent();
1052-
}
1053-
ValueMap[SGV] = NewGV;
1044+
if (DGV && DGV->hasCommonLinkage() && SGV->hasCommonLinkage())
1045+
NewGO->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment()));
1046+
}
1047+
1048+
// Make sure to remember this mapping.
1049+
if (NewGV != DGV) {
1050+
if (DGV) {
1051+
DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewGV, DGV->getType()));
1052+
DGV->eraseFromParent();
10541053
}
1054+
ValueMap[SGV] = NewGV;
10551055
}
10561056

10571057
return false;

0 commit comments

Comments
 (0)