summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/COFF/ICF.cpp9
-rw-r--r--lld/ELF/ICF.cpp5
2 files changed, 8 insertions, 6 deletions
diff --git a/lld/COFF/ICF.cpp b/lld/COFF/ICF.cpp
index e50b951c34d..1032fb0ec7a 100644
--- a/lld/COFF/ICF.cpp
+++ b/lld/COFF/ICF.cpp
@@ -61,9 +61,9 @@ private:
// Returns a hash value for S.
uint32_t ICF::getHash(SectionChunk *C) {
- return hash_combine(C->getPermissions(), hash_value(C->SectionName),
- C->NumRelocs, C->Alignment,
- uint32_t(C->Header->SizeOfRawData), C->Checksum);
+ return hash_combine(C->getPermissions(), C->SectionName, C->NumRelocs,
+ C->Alignment, uint32_t(C->Header->SizeOfRawData),
+ C->Checksum, C->getContents());
}
// Returns true if section S is subject of ICF.
@@ -210,9 +210,10 @@ void ICF::run(const std::vector<Chunk *> &Vec) {
}
// Initially, we use hash values to partition sections.
- for (SectionChunk *SC : Chunks)
+ for_each(parallel::par, Chunks.begin(), Chunks.end(), [&](SectionChunk *SC) {
// Set MSB to 1 to avoid collisions with non-hash classs.
SC->Class[0] = getHash(SC) | (1 << 31);
+ });
// From now on, sections in Chunks are ordered so that sections in
// the same group are consecutive in the vector.
diff --git a/lld/ELF/ICF.cpp b/lld/ELF/ICF.cpp
index 6d70e9bcab3..30b9be91bd3 100644
--- a/lld/ELF/ICF.cpp
+++ b/lld/ELF/ICF.cpp
@@ -155,7 +155,7 @@ private:
// Returns a hash value for S. Note that the information about
// relocation targets is not included in the hash value.
template <class ELFT> static uint32_t getHash(InputSection *S) {
- return hash_combine(S->Flags, S->getSize(), S->NumRelocations);
+ return hash_combine(S->Flags, S->getSize(), S->NumRelocations, S->Data);
}
// Returns true if section S is subject of ICF.
@@ -394,9 +394,10 @@ template <class ELFT> void ICF<ELFT>::run() {
Sections.push_back(S);
// Initially, we use hash values to partition sections.
- for (InputSection *S : Sections)
+ parallelForEach(Sections, [&](InputSection *S) {
// Set MSB to 1 to avoid collisions with non-hash IDs.
S->Class[0] = getHash<ELFT>(S) | (1 << 31);
+ });
// From now on, sections in Sections vector are ordered so that sections
// in the same equivalence class are consecutive in the vector.
OpenPOWER on IntegriCloud