aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/FunctionResolution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-31 21:08:45 +0000
committerChris Lattner <sabre@nondot.org>2003-05-31 21:08:45 +0000
commit12ce59d3c58ec4397e38b5acf2dd654ed578439e (patch)
tree43f89886a1722ad47bcdd300502df40b16d50a2f /lib/Transforms/IPO/FunctionResolution.cpp
parentcfea29ff6da3746c8ea02175e31237c4b67ec398 (diff)
Fix bug: FuncResolve/2003-05-31-InternalDecl.ll
Count resolutions correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/FunctionResolution.cpp')
-rw-r--r--lib/Transforms/IPO/FunctionResolution.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp
index 5b2e39fdad..18a28895fd 100644
--- a/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/lib/Transforms/IPO/FunctionResolution.cpp
@@ -193,9 +193,14 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
// If there are any more uses that we could not resolve, force them to use
// a casted pointer now.
if (!Old->use_empty()) {
+ NumResolved += Old->use_size();
Constant *NewCPR = ConstantPointerRef::get(Concrete);
Old->replaceAllUsesWith(ConstantExpr::getCast(NewCPR, Old->getType()));
+ Changed = true;
}
+
+ // Since there are no uses of Old anymore, remove it from the module.
+ M.getFunctionList().erase(Old);
}
return Changed;
}
@@ -345,8 +350,7 @@ bool FunctionResolvingPass::run(Module &M) {
GlobalValue *GV = cast<GlobalValue>(PI->second);
assert(PI->first == GV->getName() &&
"Global name and symbol table do not agree!");
- if (!GV->hasInternalLinkage()) // Only resolve decls to external fns
- Globals[PI->first].push_back(GV);
+ Globals[PI->first].push_back(GV);
}
}