[lld] r247168 - ELF2: Reduce nesting by returning early. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 10:55:10 PDT 2015
Author: ruiu
Date: Wed Sep 9 12:55:09 2015
New Revision: 247168
URL: http://llvm.org/viewvc/llvm-project?rev=247168&view=rev
Log:
ELF2: Reduce nesting by returning early. NFC.
Modified:
lld/trunk/ELF/Symbols.cpp
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=247168&r1=247167&r2=247168&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Wed Sep 9 12:55:09 2015
@@ -50,22 +50,20 @@ template <class ELFT> int SymbolBody::co
if (L != R)
return -1;
-
if (!L.first || !L.second)
return 1;
if (isCommon()) {
- if (Other->isCommon()) {
- auto *ThisC = cast<DefinedCommon<ELFT>>(this);
- auto *OtherC = cast<DefinedCommon<ELFT>>(Other);
- typename DefinedCommon<ELFT>::uintX_t MaxAlign =
- std::max(ThisC->MaxAlignment, OtherC->MaxAlignment);
- if (ThisC->Sym.st_size >= OtherC->Sym.st_size) {
- ThisC->MaxAlignment = MaxAlign;
- return 1;
- }
- OtherC->MaxAlignment = MaxAlign;
+ if (!Other->isCommon())
return -1;
+ auto *ThisC = cast<DefinedCommon<ELFT>>(this);
+ auto *OtherC = cast<DefinedCommon<ELFT>>(Other);
+ typename DefinedCommon<ELFT>::uintX_t MaxAlign =
+ std::max(ThisC->MaxAlignment, OtherC->MaxAlignment);
+ if (ThisC->Sym.st_size >= OtherC->Sym.st_size) {
+ ThisC->MaxAlignment = MaxAlign;
+ return 1;
}
+ OtherC->MaxAlignment = MaxAlign;
return -1;
}
if (Other->isCommon())
More information about the llvm-commits
mailing list