summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2018-01-20 00:14:16 +0000
committerRui Ueyama <ruiu@google.com>2018-01-20 00:14:16 +0000
commit2f8af79927c5902900a7ddeef2300ea92a9fcf22 (patch)
tree2dd82f0904259f5282bcb5eebdb1db37cb1b03a6
parent6f10bd21f08b045305ccc1abf4e43ff5a9104bdd (diff)
downloadbcm5719-llvm-2f8af79927c5902900a7ddeef2300ea92a9fcf22.tar.gz
bcm5719-llvm-2f8af79927c5902900a7ddeef2300ea92a9fcf22.zip
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. llvm-svn: 323014
-rw-r--r--lld/ELF/SyntheticSections.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 8168eaaf103..30c0cbb38e3 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1743,7 +1743,7 @@ void GnuHashTableSection::writeTo(uint8_t *Buf) {
// [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);
OpenPOWER on IntegriCloud