mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
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
This commit is contained in:
parent
81d4e14449
commit
b12b75365a
@ -46,13 +46,19 @@ namespace {
|
|||||||
// Nothing to do if no unreachable functions have been found...
|
// Nothing to do if no unreachable functions have been found...
|
||||||
if (FunctionsToDelete.empty()) return false;
|
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.
|
// them, delete them now.
|
||||||
//
|
//
|
||||||
for (std::vector<CallGraphNode*>::iterator I = FunctionsToDelete.begin(),
|
for (std::vector<CallGraphNode*>::iterator I = FunctionsToDelete.begin(),
|
||||||
E = FunctionsToDelete.end(); I != E; ++I)
|
E = FunctionsToDelete.end(); I != E; ++I)
|
||||||
delete CallGraph.removeFunctionFromModule(*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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user