diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-10-22 04:43:18 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-10-22 04:43:18 +0000 |
| commit | 6d3425e87a899e4796ac24ebe0b90e9d785d23c3 (patch) | |
| tree | 174c9b953f022212eceeccf416c544b1c115fbe9 | |
| parent | 12b3593dea960e6aba896a90600636226a9ec5a1 (diff) | |
| download | bcm5719-llvm-6d3425e87a899e4796ac24ebe0b90e9d785d23c3.tar.gz bcm5719-llvm-6d3425e87a899e4796ac24ebe0b90e9d785d23c3.zip | |
Update the 'used' flag correctly
llvm-svn: 9366
| -rw-r--r-- | llvm/lib/Transforms/IPO/FunctionResolution.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionResolution.cpp b/llvm/lib/Transforms/IPO/FunctionResolution.cpp index 844bc0027d1..b8af50269de 100644 --- a/llvm/lib/Transforms/IPO/FunctionResolution.cpp +++ b/llvm/lib/Transforms/IPO/FunctionResolution.cpp @@ -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 |

