<div dir="ltr">Apologies, I believe r303805 fixes the issue.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 24, 2017 at 1:46 PM, Aleksey Shlyapnikov <span dir="ltr"><<a href="mailto:alekseys@google.com" target="_blank">alekseys@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><a href="http://lab.llvm.org:8011/builders/sanitizer-windows/builds/11813" target="_blank">http://lab.llvm.org:8011/<wbr>builders/sanitizer-windows/<wbr>builds/11813</a> reports lld related failures, please check.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 24, 2017 at 12:56 PM, Rui Ueyama via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ruiu<br>
Date: Wed May 24 14:56:29 2017<br>
New Revision: 303801<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=303801&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=303801&view=rev</a><br>
Log:<br>
Close the gap between ELF and COFF ICF implementations. NFC.<br>
<br>
We originally wrote the ICF code for COFF and ported it to ELF.<br>
They started diverging since then. This patch closes the gap.<br>
<br>
Modified:<br>
lld/trunk/COFF/ICF.cpp<br>
<br>
Modified: lld/trunk/COFF/ICF.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/ICF.cpp?rev=303801&r1=303800&r2=303801&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/COFF/ICF.cpp?<wbr>rev=303801&r1=303800&r2=303801<wbr>&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/COFF/ICF.cpp (original)<br>
+++ lld/trunk/COFF/ICF.cpp Wed May 24 14:56:29 2017<br>
@@ -56,7 +56,6 @@ private:<br>
<br>
std::vector<SectionChunk *> Chunks;<br>
int Cnt = 0;<br>
- std::atomic<uint32_t> NextId = {1};<br>
std::atomic<bool> Repeat = {false};<br>
};<br>
<br>
@@ -98,10 +97,10 @@ void ICF::segregate(size_t Begin, size_t<br>
});<br>
size_t Mid = Bound - Chunks.begin();<br>
<br>
- // Split [Begin, End) into [Begin, Mid) and [Mid, End).<br>
- uint32_t Id = NextId++;<br>
+ // Split [Begin, End) into [Begin, Mid) and [Mid, End). We use Mid as an<br>
+ // equivalence class ID because every group ends with a unique index.<br>
for (size_t I = Begin; I < Mid; ++I)<br>
- Chunks[I]->Class[(Cnt + 1) % 2] = Id;<br>
+ Chunks[I]->Class[(Cnt + 1) % 2] = Mid;<br>
<br>
// If we created a group, we need to iterate the main loop again.<br>
if (Mid != End)<br>
@@ -186,6 +185,7 @@ void ICF::forEachClass(std::functio<wbr>n<voi<br>
// call Fn sequentially.<br>
if (Chunks.size() < 1024) {<br>
forEachClassRange(0, Chunks.size(), Fn);<br>
+ ++Cnt;<br>
return;<br>
}<br>
<br>
@@ -196,6 +196,7 @@ void ICF::forEachClass(std::functio<wbr>n<voi<br>
size_t End = (I == NumShards - 1) ? Chunks.size() : (I + 1) * Step;<br>
forEachClassRange(I * Step, End, Fn);<br>
});<br>
+ ++Cnt;<br>
}<br>
<br>
// Merge identical COMDAT sections.<br>
@@ -203,22 +204,15 @@ void ICF::forEachClass(std::functio<wbr>n<voi<br>
// contents and relocations are all the same.<br>
void ICF::run(const std::vector<Chunk *> &Vec) {<br>
// Collect only mergeable sections and group by hash value.<br>
- for (Chunk *C : Vec) {<br>
- auto *SC = dyn_cast<SectionChunk>(C);<br>
- if (!SC)<br>
- continue;<br>
-<br>
- if (isEligible(SC)) {<br>
- // Set MSB to 1 to avoid collisions with non-hash classs.<br>
- SC->Class[0] = getHash(SC) | (1 << 31);<br>
- Chunks.push_back(SC);<br>
- } else {<br>
- SC->Class[0] = NextId++;<br>
- }<br>
- }<br>
-<br>
- if (Chunks.empty())<br>
- return;<br>
+ for (Chunk *C : Vec)<br>
+ if (auto *SC = dyn_cast<SectionChunk>(C))<br>
+ if (isEligible(SC))<br>
+ Chunks.push_back(SC);<br>
+<br>
+ // Initially, we use hash values to partition sections.<br>
+ for (SectionChunk *SC : Chunks)<br>
+ // Set MSB to 1 to avoid collisions with non-hash classs.<br>
+ SC->Class[0] = getHash(SC) | (1 << 31);<br>
<br>
// From now on, sections in Chunks are ordered so that sections in<br>
// the same group are consecutive in the vector.<br>
@@ -229,14 +223,12 @@ void ICF::run(const std::vector<Chunk *><br>
<br>
// Compare static contents and assign unique IDs for each static content.<br>
forEachClass([&](size_t Begin, size_t End) { segregate(Begin, End, true); });<br>
- ++Cnt;<br>
<br>
// Split groups by comparing relocations until convergence is obtained.<br>
do {<br>
Repeat = false;<br>
forEachClass(<br>
[&](size_t Begin, size_t End) { segregate(Begin, End, false); });<br>
- ++Cnt;<br>
} while (Repeat);<br>
<br>
log("ICF needed " + Twine(Cnt) + " iterations");<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>