summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/FunctionResolution.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-07-18 00:44:37 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-07-18 00:44:37 +0000
commit518310cb0d136906ff0a99d7a24cb460794de5bf (patch)
treed8ad6b32edf261c90ce2c190f4c74dc3d044502f /lib/Transforms/IPO/FunctionResolution.cpp
parent593eb952281138e1877adbfb11b88b6e32fdd732 (diff)
downloadllvm-518310cb0d136906ff0a99d7a24cb460794de5bf.tar.gz
llvm-518310cb0d136906ff0a99d7a24cb460794de5bf.tar.bz2
llvm-518310cb0d136906ff0a99d7a24cb460794de5bf.tar.xz
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/FunctionResolution.cpp')
-rw-r--r--lib/Transforms/IPO/FunctionResolution.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp
index 303cad1e7d..695287f7c4 100644
--- a/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/lib/Transforms/IPO/FunctionResolution.cpp
@@ -101,8 +101,7 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
if (!Old->use_empty()) { // Avoid making the CPR unless we really need it
Value *Replacement = Concrete;
if (Concrete->getType() != Old->getType())
- Replacement = ConstantExpr::getCast(ConstantPointerRef::get(Concrete),
- Old->getType());
+ Replacement = ConstantExpr::getCast(Concrete,Old->getType());
NumResolved += Old->use_size();
Old->replaceAllUsesWith(Replacement);
}
@@ -118,11 +117,10 @@ static bool ResolveGlobalVariables(Module &M,
std::vector<GlobalValue*> &Globals,
GlobalVariable *Concrete) {
bool Changed = false;
- Constant *CCPR = ConstantPointerRef::get(Concrete);
for (unsigned i = 0; i != Globals.size(); ++i)
if (Globals[i] != Concrete) {
- Constant *Cast = ConstantExpr::getCast(CCPR, Globals[i]->getType());
+ Constant *Cast = ConstantExpr::getCast(Concrete, Globals[i]->getType());
Globals[i]->replaceAllUsesWith(Cast);
// Since there are no uses of Old anymore, remove it from the module.
@@ -138,8 +136,8 @@ static bool ResolveGlobalVariables(Module &M,
static bool CallersAllIgnoreReturnValue(Function &F) {
if (F.getReturnType() == Type::VoidTy) return true;
for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) {
- if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(*I)) {
- for (Value::use_iterator I = CPR->use_begin(), E = CPR->use_end();
+ if (GlobalValue *GV = dyn_cast<GlobalValue>(*I)) {
+ for (Value::use_iterator I = GV->use_begin(), E = GV->use_end();
I != E; ++I) {
CallSite CS = CallSite::get(*I);
if (!CS.getInstruction() || !CS.getInstruction()->use_empty())