Account for global variables resolved more accurately.

llvm-svn: 4143
This commit is contained in:
Chris Lattner 2002-10-13 17:30:30 +00:00
parent 88dbc4dbe9
commit 5f9f4e3aac
1 changed files with 5 additions and 3 deletions

View File

@ -236,14 +236,16 @@ static bool ProcessGlobalsWithSameName(Module &M,
// later.
//
if (Globals[i]->isExternal() && Globals[i]->use_empty()) {
if (isFunction)
if (isFunction) {
M.getFunctionList().erase(cast<Function>(Globals[i]));
else
++NumResolved;
} else {
M.getGlobalList().erase(cast<GlobalVariable>(Globals[i]));
++NumGlobals;
}
Globals.erase(Globals.begin()+i);
Changed = true;
++NumResolved;
} else if (isFunction) {
// For functions, we look to merge functions definitions of "int (...)"
// to 'int (int)' or 'int ()' or whatever else is not completely generic.