hanchenye-llvm-project/llvm/test/Transforms/MergeFunc
whitequark 8f0ab258bd [MergeFunctions] Fix merging of small weak functions
When two interposable functions are merged, we cannot replace
uses and have to emit calls to a common internal function. However,
writeThunk() will not actually emit a thunk if the function is too
small. This leaves us in a broken state where mergeTwoFunctions
already rewired the functions, but writeThunk doesn't do anything.

This patch changes the implementation so that:

 * writeThunk() does just that.
 * The direct replacement of calls is moved into mergeTwoFunctions()
   into the non-interposable case only.
 * isThunkProfitable() is extracted and will be called for
   the non-iterposable case always, and in the interposable case
   only if uses are still left after replacement.

This issue has been introduced in https://reviews.llvm.org/D34806,
where the code for checking thunk profitability has been moved.

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

Reviewed By: whitequark

llvm-svn: 332342
2018-05-15 11:31:07 +00:00
..
2011-02-08-RemoveEqual.ll
2013-01-10-MergeFuncAssert.ll
address-spaces.ll
alloca.ll
apply_function_attributes.ll
call-and-invoke-with-ranges.ll
constant-entire-value.ll
crash.ll
crash2.ll
fold-weak.ll
functions.ll
gep-base-type.ll
inline-asm.ll [PR37339] Fix assertion in FunctionComparator::cmpInlineAsm 2018-05-10 15:05:47 +00:00
inttoptr-address-space.ll
inttoptr.ll
linkonce_odr.ll
merge-block-address-other-function.ll
merge-block-address.ll
merge-const-ptr-and-int.ll
merge-different-vector-types.ll
merge-ptr-and-int.ll
merge-small-unnamed-addr.ll
merge-unnamed-addr-bitcast.ll
merge-unnamed-addr.ll
merge-weak-crash.ll
mergefunc-preserve-debug-info.ll
mergefunc-struct-return.ll
no-merge-block-address-different-labels.ll
no-merge-block-address-other-function.ll
no-merge-ptr-different-sizes.ll
no-merge-ptr-int-different-values.ll
phi-check-blocks.ll
phi-speculation1.ll
phi-speculation2.ll
ptr-int-transitivity-1.ll
ptr-int-transitivity-2.ll
ptr-int-transitivity-3.ll
ranges-multiple.ll
ranges.ll
self-referential-global.ll
too-small.ll
undef-different-types.ll
vector-GEP-crash.ll
vector.ll
vectors-and-arrays.ll
weak-small.ll [MergeFunctions] Fix merging of small weak functions 2018-05-15 11:31:07 +00:00