[Attributor] Use internalized version of non-exact functions
authorLuofan Chen <clfbbn@gmail.com>
Sat, 15 Aug 2020 11:17:44 +0000 (19:17 +0800)
committerLuofan Chen <clfbbn@gmail.com>
Sat, 15 Aug 2020 12:23:38 +0000 (20:23 +0800)
commit87a85f3d57f55f5652ec44f77816c7c9457545fa
tree392358432a361e68ee01e195aabe8eac9aa65f06
parent4a0b95dc5e4d57ee0abefb27b5556c30a735001c
[Attributor] Use internalized version of non-exact functions

This patch internalize non-exact functions and replaces of their uses
with the internalized version. Doing this enables the analysis of
non-exact functions.

We can do this because some non-exact functions with the same name
whose linkage is `linkonce_odr` or `weak_odr` should have the same
semantics, so we can safely internalize and replace use of them (the
result of the other version of this function should be the same.).
Note that not all functions can be internalized, e.g., function with
`linkonce` or `weak` linkage.

For now when specified in commandline, we internalize all functions
that meet the requirements without calculating the cost of such
internalzation.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D84167
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/Attributor/internalize.ll [new file with mode: 0644]