[PATCH] D44150: [WebAssembly] Use DenseMapInfo traits from LLVM repo. NFC

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 14 14:45:57 PDT 2018


sbc100 added a comment.

In https://reviews.llvm.org/D44150#1037839, @ruiu wrote:

> > - ICF support (fold identical constant data sections together)
>
> For ICF, I'd recommend you make an improvement to the compiler and the wasm object file format first. The current implementation of lld's ICF is in some sense too aggressive -- it merges functions when they are identical. But that's actually a violation of the C/C++ spec because if you take addresses of two different functions, they must be distinct. If your program depends on pointer uniqueness, lld's ICF break your program.
>
> On the other hand, lld is conservative on merging data. Comparing two pointers for data is more common in programs, so we don't merge two read-only data by ICF even if their contents are identical. So there's a missed opportunity here.
>
> What we really should do is to make an improvement to the compiler so that it emits the information as to whether an address is significant or not for each chunk, and use that information in the linker. In this way, we can optimize linker output for size the most.


Would including llvm's `nnamed_addr`/`local_unnamed_addr` attribute in the symbol info be right direction for this?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D44150





More information about the llvm-commits mailing list