mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
Update the 'used' flag correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -245,24 +245,25 @@ bool FunctionResolvingPass::run(Module &M) {
|
|||||||
// algorithm here to avoid problems with iterators getting invalidated if we
|
// algorithm here to avoid problems with iterators getting invalidated if we
|
||||||
// did a one pass scheme.
|
// did a one pass scheme.
|
||||||
//
|
//
|
||||||
|
bool Changed = false;
|
||||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ) {
|
for (Module::iterator I = M.begin(), E = M.end(); I != E; ) {
|
||||||
Function *F = I++;
|
Function *F = I++;
|
||||||
if (F->use_empty() && F->isExternal())
|
if (F->use_empty() && F->isExternal()) {
|
||||||
M.getFunctionList().erase(F);
|
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);
|
Globals[F->getName()].push_back(F);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) {
|
for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) {
|
||||||
GlobalVariable *GV = I++;
|
GlobalVariable *GV = I++;
|
||||||
if (GV->use_empty() && GV->isExternal())
|
if (GV->use_empty() && GV->isExternal()) {
|
||||||
M.getGlobalList().erase(GV);
|
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);
|
Globals[GV->getName()].push_back(GV);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Changed = false;
|
|
||||||
|
|
||||||
TargetData &TD = getAnalysis<TargetData>();
|
TargetData &TD = getAnalysis<TargetData>();
|
||||||
|
|
||||||
// Now we have a list of all functions with a particular name. If there is
|
// Now we have a list of all functions with a particular name. If there is
|
||||||
|
Reference in New Issue
Block a user