[lld] r328739 - Move code so that the code matches with a comment. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 28 15:47:53 PDT 2018


Author: ruiu
Date: Wed Mar 28 15:47:53 2018
New Revision: 328739

URL: http://llvm.org/viewvc/llvm-project?rev=328739&view=rev
Log:
Move code so that the code matches with a comment. NFC.

Modified:
    lld/trunk/ELF/ICF.cpp

Modified: lld/trunk/ELF/ICF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ICF.cpp?rev=328739&r1=328738&r2=328739&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.cpp (original)
+++ lld/trunk/ELF/ICF.cpp Wed Mar 28 15:47:53 2018
@@ -162,6 +162,9 @@ template <class ELFT> static uint32_t ge
 
 // Returns true if section S is subject of ICF.
 static bool isEligible(InputSection *S) {
+  if (!S->Live || !(S->Flags & SHF_ALLOC) || (S->Flags & SHF_WRITE))
+    return false;
+
   // Don't merge read only data sections unless
   // --ignore-data-address-equality was passed.
   if (!(S->Flags & SHF_EXECINSTR) && !Config->IgnoreDataAddressEquality)
@@ -173,11 +176,12 @@ static bool isEligible(InputSection *S)
   if (isa<SyntheticSection>(S))
     return false;
 
-  // .init and .fini contains instructions that must be executed to
-  // initialize and finalize the process. They cannot and should not
-  // be merged.
-  return S->Live && (S->Flags & SHF_ALLOC) && !(S->Flags & SHF_WRITE) &&
-         S->Name != ".init" && S->Name != ".fini";
+  // .init and .fini contains instructions that must be executed to initialize
+  // and finalize the process. They cannot and should not be merged.
+  if (S->Name == ".init" || S->Name == ".fini")
+    return false;
+
+  return true;
 }
 
 // Split an equivalence class into smaller classes.




More information about the llvm-commits mailing list