[ThinLTO] Keep non-prevailing (linkonce|weak)_odr symbols live
authorXin Tong <trent.xin.tong@gmail.com>
Mon, 8 Oct 2018 15:12:48 +0000 (15:12 +0000)
committerXin Tong <trent.xin.tong@gmail.com>
Mon, 8 Oct 2018 15:12:48 +0000 (15:12 +0000)
commitbfdad33b82b9ac535b33b2783870dffe3bd401f3
tree4b10dbc758b6d57656d06b6656ac8d3c3a792ffc
parent367b4741f4954c9d4013ffcbfb48ca2c535fd6d1
[ThinLTO] Keep non-prevailing (linkonce|weak)_odr symbols live

Summary:
If we have a symbol with (linkonce|weak)_odr linkage, we do not want
to dead strip it even it is not prevailing.

IR level (linkonce|weak)_odr symbol can become non-prevailing when we mix
ELF objects and IR objects where the (linkonce|weak)_odr symbol in the ELF
object is prevailing and the ones in the IR objects are not. Stripping
them will prevent us from doing optimizations with them.

By not dead stripping them, We will convert these symbols to
available_externally linkage as a result of non-prevailing and eventually
dropping them after inlining.

I modified cache-prevailing.ll to use linkonce linkage as it is
testing whether cache prevailing bit is effective or not, not
we should treat linkonce_odr alive or not

Reviewers: tejohnson, pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D52893

llvm-svn: 343970
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/test/LTO/Resolution/X86/cache-prevailing.ll
llvm/test/ThinLTO/X86/deadstrip.ll
llvm/test/Transforms/FunctionImport/not-prevailing.ll