diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp index f991229e9852a3a152f0558e3e52a34acc87fd14..5ce79625b84b72b9a3ec384ed4e59f55c4b0da88 100644 --- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp +++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp @@ -56,9 +56,11 @@ namespace { // 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()) + if (I->use_size() == 0 && I->isExternal()) { + CallGraph[I]->removeAllCalledFunctions(); delete CallGraph.removeFunctionFromModule(I); - + } + return true; }