diff options
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalDCE.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp index 55ef5d42207..c7fddc99139 100644 --- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp +++ b/llvm/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; } |