Skip to content
Snippets Groups Projects
Commit 6d3425e8 authored by Chris Lattner's avatar Chris Lattner
Browse files

Update the 'used' flag correctly

llvm-svn: 9366
parent 12b3593d
No related branches found
No related tags found
No related merge requests found
......@@ -245,24 +245,25 @@ bool FunctionResolvingPass::run(Module &M) {
// algorithm here to avoid problems with iterators getting invalidated if we
// did a one pass scheme.
//
bool Changed = false;
for (Module::iterator I = M.begin(), E = M.end(); I != E; ) {
Function *F = I++;
if (F->use_empty() && F->isExternal())
if (F->use_empty() && F->isExternal()) {
M.getFunctionList().erase(F);
else if (!F->hasInternalLinkage() && !F->getName().empty())
Changed = true;
} else if (!F->hasInternalLinkage() && !F->getName().empty())
Globals[F->getName()].push_back(F);
}
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) {
GlobalVariable *GV = I++;
if (GV->use_empty() && GV->isExternal())
if (GV->use_empty() && GV->isExternal()) {
M.getGlobalList().erase(GV);
else if (!GV->hasInternalLinkage() && !GV->getName().empty())
Changed = true;
} else if (!GV->hasInternalLinkage() && !GV->getName().empty())
Globals[GV->getName()].push_back(GV);
}
bool Changed = false;
TargetData &TD = getAnalysis<TargetData>();
// Now we have a list of all functions with a particular name. If there is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment