[lld] r275234 - Simplify. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 12 16:28:30 PDT 2016


Author: ruiu
Date: Tue Jul 12 18:28:30 2016
New Revision: 275234

URL: http://llvm.org/viewvc/llvm-project?rev=275234&view=rev
Log:
Simplify. NFC.

Config->Pic is true if (Config->Pie || Config->Shared) is true,
so this extra check was redundant.

Modified:
    lld/trunk/ELF/Thunks.cpp

Modified: lld/trunk/ELF/Thunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Thunks.cpp?rev=275234&r1=275233&r2=275234&view=diff
==============================================================================
--- lld/trunk/ELF/Thunks.cpp (original)
+++ lld/trunk/ELF/Thunks.cpp Tue Jul 12 18:28:30 2016
@@ -186,22 +186,20 @@ template <class ELFT> Thunk<ELFT>::~Thun
 template <class ELFT>
 static Thunk<ELFT> *createThunkArm(uint32_t Reloc, SymbolBody &S,
                                    InputSection<ELFT> &IS) {
-  bool NeedsPI = Config->Pic || Config->Pie || Config->Shared;
-  BumpPtrAllocator &Alloc = IS.getFile()->Alloc;
-
   // ARM relocations need ARM to Thumb interworking Thunks.
   // Thumb relocations need Thumb to ARM relocations.
   // Use position independent Thunks if we require position independent code.
+  BumpPtrAllocator &Alloc = IS.getFile()->Alloc;
   switch (Reloc) {
   case R_ARM_PC24:
   case R_ARM_PLT32:
   case R_ARM_JUMP24:
-    if (NeedsPI)
+    if (Config->Pic)
       return new (Alloc) ARMToThumbV7PILongThunk<ELFT>(S, IS);
     return new (Alloc) ARMToThumbV7ABSLongThunk<ELFT>(S, IS);
   case R_ARM_THM_JUMP19:
   case R_ARM_THM_JUMP24:
-    if (NeedsPI)
+    if (Config->Pic)
       return new (Alloc) ThumbToARMV7PILongThunk<ELFT>(S, IS);
     return new (Alloc) ThumbToARMV7ABSLongThunk<ELFT>(S, IS);
   }




More information about the llvm-commits mailing list