diff options
author | Chris Lattner <sabre@nondot.org> | 2003-06-26 05:41:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-06-26 05:41:18 +0000 |
commit | b12b75365a11e0a626b9826bff4e68272d808f19 (patch) | |
tree | 330c33641d70aa7476496e1f85e8b2146666b0e4 /lib/Transforms | |
parent | 81d4e14449fce69ca3a315685a80bb3c20a3db23 (diff) | |
download | external_llvm-b12b75365a11e0a626b9826bff4e68272d808f19.zip external_llvm-b12b75365a11e0a626b9826bff4e68272d808f19.tar.gz external_llvm-b12b75365a11e0a626b9826bff4e68272d808f19.tar.bz2 |
Add support to globaldce for deleting dead function prototypes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/GlobalDCE.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp index 55ef5d4..c7fddc9 100644 --- a/lib/Transforms/IPO/GlobalDCE.cpp +++ b/lib/Transforms/IPO/GlobalDCE.cpp @@ -46,12 +46,18 @@ namespace { // Nothing to do if no unreachable functions have been found... if (FunctionsToDelete.empty()) return false; - // Unreachables functions have been found and should have no references to + // Unreachable functions have been found and should have no references to // them, delete them now. // for (std::vector<CallGraphNode*>::iterator I = FunctionsToDelete.begin(), E = FunctionsToDelete.end(); I != E; ++I) delete CallGraph.removeFunctionFromModule(*I); + + // Walk the function list, removing prototypes for functions which are not + // used. + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + if (I->use_size() == 0 && I->isExternal()) + delete CallGraph.removeFunctionFromModule(I); return true; } |