[lld] r321581 - [ELF] - Remove excessive checks. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 30 00:40:45 PST 2017


Author: grimar
Date: Sat Dec 30 00:40:45 2017
New Revision: 321581

URL: http://llvm.org/viewvc/llvm-project?rev=321581&view=rev
Log:
[ELF] - Remove excessive checks. NFC.

This was raised in comments for D41592.
With current code we always assign parent
section for Rel[a] sections like
InX::RelaPlt or InX::RelaDyn, so checking
their parent for null is excessive.

Modified:
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=321581&r1=321580&r2=321581&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Sat Dec 30 00:40:45 2017
@@ -1064,7 +1064,7 @@ template <class ELFT> void DynamicSectio
     addInt(DT_DEBUG, 0);
 
   this->Link = InX::DynStrTab->getParent()->SectionIndex;
-  if (InX::RelaDyn->getParent() && !InX::RelaDyn->empty()) {
+  if (!InX::RelaDyn->empty()) {
     addInSec(InX::RelaDyn->DynamicTag, InX::RelaDyn);
     addSize(InX::RelaDyn->SizeDynamicTag, InX::RelaDyn->getParent());
 
@@ -1081,7 +1081,7 @@ template <class ELFT> void DynamicSectio
         addInt(IsRela ? DT_RELACOUNT : DT_RELCOUNT, NumRelativeRels);
     }
   }
-  if (InX::RelaPlt->getParent() && !InX::RelaPlt->empty()) {
+  if (!InX::RelaPlt->empty()) {
     addInSec(DT_JMPREL, InX::RelaPlt);
     addSize(DT_PLTRELSZ, InX::RelaPlt->getParent());
     switch (Config->EMachine) {




More information about the llvm-commits mailing list