diff options
author | Vedant Kumar <vsk@apple.com> | 2019-01-11 17:56:35 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2019-01-11 17:56:35 +0000 |
commit | ee10ef737e58409d1c34c68ad17b568e8a50120f (patch) | |
tree | 8e643539dfe36331c633f151b3f3b0af039cdd6f /llvm/lib/Transforms | |
parent | 08fe7e02fba6206c196d5e8527f8b40bb17941ad (diff) | |
download | bcm5719-llvm-ee10ef737e58409d1c34c68ad17b568e8a50120f.tar.gz bcm5719-llvm-ee10ef737e58409d1c34c68ad17b568e8a50120f.zip |
[MergeFunc] Erase unused duplicate functions if they are discardable
MergeFunc only deletes unused duplicate functions if they have local
linkage, but it should be safe to relax this to any "discardable if
unused" linkage type.
Differential Revision: https://reviews.llvm.org/D56574
llvm-svn: 350939
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 30fe9bbbe61..11efe95b10d 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -845,7 +845,7 @@ void MergeFunctions::mergeTwoFunctions(Function *F, Function *G) { // If G was internal then we may have replaced all uses of G with F. If so, // stop here and delete G. There's no need for a thunk. (See note on // MergeFunctionsPDI above). - if (G->hasLocalLinkage() && G->use_empty() && !MergeFunctionsPDI) { + if (G->isDiscardableIfUnused() && G->use_empty() && !MergeFunctionsPDI) { G->eraseFromParent(); ++NumFunctionsMerged; return; |