[lld] r323014 - Avoid divisions.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 16:14:16 PST 2018
Author: ruiu
Date: Fri Jan 19 16:14:16 2018
New Revision: 323014
URL: http://llvm.org/viewvc/llvm-project?rev=323014&view=rev
Log:
Avoid divisions.
Compiler doesn't know the fact that Config->WordSize * 8 is always a
power of two, so it had to use the div instruction to divide some
number with C.
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=323014&r1=323013&r2=323014&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Fri Jan 19 16:14:16 2018
@@ -1743,7 +1743,7 @@ void GnuHashTableSection::writeTo(uint8_
// [1] Ulrich Drepper (2011), "How To Write Shared Libraries" (Ver. 4.1.2),
// p.9, https://www.akkadia.org/drepper/dsohowto.pdf
void GnuHashTableSection::writeBloomFilter(uint8_t *Buf) {
- const unsigned C = Config->Wordsize * 8;
+ unsigned C = Config->Is64 ? 64 : 32;
for (const Entry &Sym : Symbols) {
size_t I = (Sym.Hash / C) & (MaskWords - 1);
uint64_t Val = readUint(Buf + I * Config->Wordsize);
More information about the llvm-commits
mailing list