llvm-project/llvm/lib/Transforms
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
..
AggressiveInstCombine [AggressiveInstCombine] avoid crashing on unsimplified code (PR37446) 2018-05-14 13:43:32 +00:00
Coroutines Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
Hello
IPO [MergeFunctions] Fix merging of small weak functions 2018-05-15 11:31:07 +00:00
InstCombine [InstCombine] fix crash due to ignored addrspacecast 2018-05-14 22:05:01 +00:00
Instrumentation Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
ObjCARC Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
Scalar [NFC] Add const to method signature 2018-05-15 01:21:56 +00:00
Utils Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
Vectorize Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
CMakeLists.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LLVMBuild.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00