[COFF] Avoid allocating temporary vectors during ICF
authorReid Kleckner <rnk@google.com>
Sat, 2 May 2020 20:28:56 +0000 (13:28 -0700)
committerReid Kleckner <rnk@google.com>
Mon, 4 May 2020 14:01:14 +0000 (07:01 -0700)
commitfce5457a141901097d0a57986eb5d3a023528059
tree02f82b21e8679f641ad0269999bdf8474f3b2bdf
parentd1ff003fbbb36891ca7752785dec86cfd1a76139
[COFF] Avoid allocating temporary vectors during ICF

Heap profiling with ETW shows that LLD performs 4,053,721 heap
allocations over its lifetime, and ~800,000 of them come from
assocEquals. These vectors are created just to do a comparison, so fuse
the comparison into the loop and avoid the allocation.

ICF is overall a small portion of the time spent linking, and I did not
measure overall throughput improvements from this change above the noise
threshold. However, these show up in the heap profiler, and the work is
done, so we might as well land it if the code is clear enough.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D79297
lld/COFF/Chunks.h
lld/COFF/ICF.cpp