[PATCH] D98993: [COFF] Only consider associated EH sections during ICF

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 16:40:54 PDT 2021


rnk created this revision.
rnk added reviewers: mstorsjo, hans.
rnk requested review of this revision.
Herald added a project: LLVM.

The only known reason why ICF should not merge otherwise identical
sections with differing associated sections has to do with exception
handling tables. It's not clear what ICF should do when there are other
kinds of associated sections. In every other case when this has come up,
debug info and CF guard metadata, we have opted to make ICF ignore the
associated sections.

For comparison, ELF doesn't do anything for comdat groups. Instead,
.eh_frame is parsed to figure out if a section has an LSDA, and if so,
ICF is disabled.

Another issue is that the order of associated sections is not defined.
We have had issues in the past where changing the order of the
.xdata/.pdata sections in the object file lead to large ICF slowdowns.

To address these issues, I decided it would be best to explicitly
consider only .pdata and .xdata sections during ICF. This makes it easy
to ignore the object file order, and I think it makes the intention of
the code clearer.

I've also made the children() accessor return an empty list for
associated sections. This mostly only affects ICF and GC. This was the
behavior before I made this a linked list, so the behavior change should
be good. This had positive effects on chrome.dll: more .xdata sections
were merged that previously could not be merged because they were
associated with distinct .pdata sections.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98993

Files:
  lld/COFF/Chunks.h
  lld/COFF/ICF.cpp
  lld/test/COFF/icf-assoc-order.s
  lld/test/COFF/icf-xdata-first.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98993.332034.patch
Type: text/x-patch
Size: 6540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210319/e74a4426/attachment.bin>


More information about the llvm-commits mailing list