[PATCH] D43361: [ThinLTO] Enable AutoHide on symbols with local_unnamed_addr

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 15 16:32:40 PDT 2018


espindola added a comment.

In https://reviews.llvm.org/D43361#1039615, @steven_wu wrote:

> So the original of this patch is thinLTO is promoting linkonce_odr to weak_odr. Think the following two situations:
>
> 1. linkonce_odr + local_unnamed_addr --> linkonce_odr compiler is dropping unnamed_addr, it is not safe to hide.
> 2. linkonce_odr + local_unnamed_addr --> weak_odr + local_unnamed_addr this is the linkage promotion by thinLTO, it is still 'safe' to hide.


The solution is to use canBeOmittedFromSymbolTable from include/llvm/Object/IRSymtab.h.

The symbol table is computed earlier and so the above predicate still returns 1. Your examples work with lld and ThinLTO if you want to check the implementation details.


Repository:
  rL LLVM

https://reviews.llvm.org/D43361





More information about the llvm-commits mailing list