[lld] r335346 - [ELF] - ICF: remove excessive check. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 06:21:37 PDT 2018


Author: grimar
Date: Fri Jun 22 06:21:37 2018
New Revision: 335346

URL: http://llvm.org/viewvc/llvm-project?rev=335346&view=rev
Log:
[ELF] - ICF: remove excessive check. NFC.

Change removes the excessive comparsion of
the relocation arrays sizes.

This code was dead, because at the higer level,
equalsConstant function contains the following check:

`A->NumRelocations != B->NumRelocations`
where NumRelocations contains the size of the relocations array.
So removed check did the same job twice.

This was found with use of code coverage analysis.

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=335346&r1=335345&r2=335346&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.cpp (original)
+++ lld/trunk/ELF/ICF.cpp Fri Jun 22 06:21:37 2018
@@ -239,9 +239,6 @@ template <class ELFT>
 template <class RelTy>
 bool ICF<ELFT>::constantEq(const InputSection *SecA, ArrayRef<RelTy> RA,
                            const InputSection *SecB, ArrayRef<RelTy> RB) {
-  if (RA.size() != RB.size())
-    return false;
-
   for (size_t I = 0; I < RA.size(); ++I) {
     if (RA[I].r_offset != RB[I].r_offset ||
         RA[I].getType(Config->IsMips64EL) != RB[I].getType(Config->IsMips64EL))




More information about the llvm-commits mailing list