Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

[MergeFunctions] Fix merging of small weak functions #114

Merged
merged 1 commit into from
May 15, 2018

Conversation

nox
Copy link

@nox nox commented May 15, 2018

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332342 91177308-0d34-0410-b5e6-96231b3b80d8
@nox
Copy link
Author

nox commented May 15, 2018

r? @alexcrichton

@alexcrichton alexcrichton merged commit 1abfd0e into rust-lang:rust-llvm-release-6-0-0 May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants