COFF: Fix ICF correctness bug.
authorRui Ueyama <ruiu@google.com>
Sun, 28 Jun 2015 01:30:54 +0000 (01:30 +0000)
committerRui Ueyama <ruiu@google.com>
Sun, 28 Jun 2015 01:30:54 +0000 (01:30 +0000)
commit871847e32d7e8faddcdc4e0e8c40ab0a6511f3d1
treee4cbc4d249cf2f03c2f4a2fb1d53fbe7bab78bb1
parent45c4812851436ea3e762b0ac2fc3102c8ee48fa0
COFF: Fix ICF correctness bug.

When comparing two COMDAT sections, we need to take section values
and associative sections into account. This patch fixes that bug.
It fixes a crash bug of llvm-tblgen when linked with /opt:lldicf.

One thing I don't understand yet is that this logic seems to be
too strict. MSVC linker is able to create more compact executables
(which of course work correctly). With this ICF algorithm, LLD is
able to make executable smaller, but the outputs are larger than
MSVC's. There must be something I'm missing here.

llvm-svn: 240897
lld/COFF/Chunks.cpp
lld/COFF/Chunks.h
lld/COFF/Symbols.h
lld/test/COFF/Inputs/icf4.yaml [new file with mode: 0644]
lld/test/COFF/Inputs/icf5.yaml [new file with mode: 0644]
lld/test/COFF/icf.test