[lld] r262155 - ELF: Remove relSize function from ICF.cpp. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 27 12:29:45 PST 2016


Author: ruiu
Date: Sat Feb 27 14:29:45 2016
New Revision: 262155

URL: http://llvm.org/viewvc/llvm-project?rev=262155&view=rev
Log:
ELF: Remove relSize function from ICF.cpp. 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=262155&r1=262154&r2=262155&view=diff
==============================================================================
--- lld/trunk/ELF/ICF.cpp (original)
+++ lld/trunk/ELF/ICF.cpp Sat Feb 27 14:29:45 2016
@@ -120,22 +120,14 @@ private:
 }
 }
 
-// Returns a hash seed for relocation sections for S.
-template <class ELFT> uint64_t ICF<ELFT>::relSize(InputSection<ELFT> *S) {
-  uint64_t Ret = 0;
-  for (const Elf_Shdr *H : S->RelocSections)
-    Ret += H->sh_size;
-  return Ret;
-}
-
 // Returns a hash value for S. Note that the information about
 // relocation targets is not included in the hash value.
 template <class ELFT> uint64_t ICF<ELFT>::getHash(InputSection<ELFT> *S) {
   uint64_t Flags = S->getSectionHdr()->sh_flags;
   uint64_t H = hash_combine(Flags, S->getSize());
-  if (S->RelocSections.empty())
-    return H;
-  return hash_combine(H, relSize(S));
+  for (const Elf_Shdr *Rel : S->RelocSections)
+    H = hash_combine(H, (uint64_t)Rel->sh_size);
+  return H;
 }
 
 // Returns true if Sec is subject of ICF.




More information about the llvm-commits mailing list