[lld] r304368 - Merge two nested ifs. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 15:46:19 PDT 2017


Author: rafael
Date: Wed May 31 17:46:19 2017
New Revision: 304368

URL: http://llvm.org/viewvc/llvm-project?rev=304368&view=rev
Log:
Merge two nested ifs. NFC.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=304368&r1=304367&r2=304368&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed May 31 17:46:19 2017
@@ -1694,17 +1694,15 @@ template <class ELFT> void Writer<ELFT>:
 
   // Setup MIPS _gp_disp/__gnu_local_gp symbols which should
   // be equal to the _gp symbol's value.
-  if (Config->EMachine == EM_MIPS) {
-    if (!ElfSym::MipsGp->Value) {
-      // Find GP-relative section with the lowest address
-      // and use this address to calculate default _gp value.
-      uint64_t Gp = -1;
-      for (const OutputSection *OS : OutputSections)
-        if ((OS->Flags & SHF_MIPS_GPREL) && OS->Addr < Gp)
-          Gp = OS->Addr;
-      if (Gp != (uint64_t)-1)
-        ElfSym::MipsGp->Value = Gp + 0x7ff0;
-    }
+  if (Config->EMachine == EM_MIPS && !ElfSym::MipsGp->Value) {
+    // Find GP-relative section with the lowest address
+    // and use this address to calculate default _gp value.
+    uint64_t Gp = -1;
+    for (const OutputSection *OS : OutputSections)
+      if ((OS->Flags & SHF_MIPS_GPREL) && OS->Addr < Gp)
+        Gp = OS->Addr;
+    if (Gp != (uint64_t)-1)
+      ElfSym::MipsGp->Value = Gp + 0x7ff0;
   }
 }
 




More information about the llvm-commits mailing list