diff options
author | whitequark <whitequark@whitequark.org> | 2018-11-08 03:57:55 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2018-11-08 03:57:55 +0000 |
commit | 3580ac6125dd6bc59b5e60134cf586687af01ec7 (patch) | |
tree | 8af78f4754cc48ed938eb5407d70dfae8c41079c /llvm/lib/Transforms/IPO/MergeFunctions.cpp | |
parent | 897171902b2cd6b90e2f555f6a29b5f6a92e83cf (diff) | |
download | llvm-3580ac6125dd6bc59b5e60134cf586687af01ec7.zip llvm-3580ac6125dd6bc59b5e60134cf586687af01ec7.tar.gz llvm-3580ac6125dd6bc59b5e60134cf586687af01ec7.tar.bz2 |
[MergeFuncs] Call removeUsers() prior to unnamed_addr RAUW
Summary:
For unnamed_addr functions we RAUW instead of only replacing direct callers. However, functions in which replacements were performed currently are not added back to the worklist, resulting in missed merging opportunities.
Fix this by calling removeUsers() prior to RAUW.
Reviewers: jfb, whitequark
Reviewed By: whitequark
Subscribers: rkruppe, llvm-commits
Differential Revision: https://reviews.llvm.org/D53262
llvm-svn: 346385
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index e8056e6..49b3eac 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -770,6 +770,7 @@ void MergeFunctions::mergeTwoFunctions(Function *F, Function *G) { GlobalNumbers.erase(G); // If G's address is not significant, replace it entirely. Constant *BitcastF = ConstantExpr::getBitCast(F, G->getType()); + removeUsers(G); G->replaceAllUsesWith(BitcastF); } else { // Redirect direct callers of G to F. (See note on MergeFunctionsPDI |