Fix a bug John tracked down in libstdc++ where we were incorrectly deleting

weak functions.  Thanks for finding this John!

llvm-svn: 16997
This commit is contained in:
Chris Lattner 2004-10-14 19:53:50 +00:00
parent 1f864b5583
commit 5d33e8e73a
1 changed files with 2 additions and 1 deletions

View File

@ -808,7 +808,8 @@ bool GlobalOpt::runOnModule(Module &M) {
for (Module::iterator FI = M.begin(), E = M.end(); FI != E; ) {
Function *F = FI++;
F->removeDeadConstantUsers();
if (F->use_empty() && (F->hasInternalLinkage() || F->hasWeakLinkage())) {
if (F->use_empty() && (F->hasInternalLinkage() ||
F->hasLinkOnceLinkage())) {
M.getFunctionList().erase(F);
LocalChange = true;
++NumFnDeleted;