aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/IPA
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/IPA')
-rw-r--r--lib/Analysis/IPA/Andersens.cpp8
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp6
-rw-r--r--lib/Analysis/IPA/FindUsedTypes.cpp7
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp6
4 files changed, 12 insertions, 15 deletions
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 6b24a12421..12f0fc3006 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -479,8 +479,8 @@ Andersens::Node *Andersens::getNodeForConstantPointer(Constant *C) {
if (isa<ConstantPointerNull>(C))
return &GraphNodes[NullPtr];
- else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C))
- return getNode(CPR->getValue());
+ else if (GlobalValue *GV = dyn_cast<GlobalValue>(C))
+ return getNode(GV);
else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
switch (CE->getOpcode()) {
case Instruction::GetElementPtr:
@@ -507,8 +507,8 @@ Andersens::Node *Andersens::getNodeForConstantPointerTarget(Constant *C) {
if (isa<ConstantPointerNull>(C))
return &GraphNodes[NullObject];
- else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C))
- return getObject(CPR->getValue());
+ else if (GlobalValue *GV = dyn_cast<GlobalValue>(C))
+ return getObject(GV);
else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
switch (CE->getOpcode()) {
case Instruction::GetElementPtr:
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index 70bf2c496b..72b4bdbc52 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -73,10 +73,8 @@ void CallGraph::addToCallGraph(Function *F) {
getNodeFor(Inst->getParent()->getParent())->addCalledFunction(Node);
else
isUsedExternally = true;
- } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(*I)) {
- // THIS IS A DISGUSTING HACK. Brought to you by the power of
- // ConstantPointerRefs!
- for (Value::use_iterator I = CPR->use_begin(), E = CPR->use_end();
+ } else if (GlobalValue *GV = dyn_cast<GlobalValue>(*I)) {
+ for (Value::use_iterator I = GV->use_begin(), E = GV->use_end();
I != E; ++I)
if (Instruction *Inst = dyn_cast<Instruction>(*I)) {
if (isOnlyADirectCall(F, CallSite::get(Inst)))
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index a8527772fa..1f127fe82d 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -48,9 +48,10 @@ void FindUsedTypes::IncorporateValue(const Value *V) {
// If this is a constant, it could be using other types...
if (const Constant *C = dyn_cast<Constant>(V)) {
- for (User::const_op_iterator OI = C->op_begin(), OE = C->op_end();
- OI != OE; ++OI)
- IncorporateValue(*OI);
+ if (!isa<GlobalValue>(C))
+ for (User::const_op_iterator OI = C->op_begin(), OE = C->op_end();
+ OI != OE; ++OI)
+ IncorporateValue(*OI);
}
}
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index c3f6ba9386..cb1d360a93 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -165,8 +165,8 @@ bool GlobalsModRef::AnalyzeUsesOfGlobal(Value *V,
} else {
return true;
}
- } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(*UI)) {
- if (AnalyzeUsesOfGlobal(CPR, Readers, Writers)) return true;
+ } else if (GlobalValue *GV = dyn_cast<GlobalValue>(*UI)) {
+ if (AnalyzeUsesOfGlobal(GV, Readers, Writers)) return true;
} else {
return true;
}
@@ -257,8 +257,6 @@ static const GlobalValue *getUnderlyingObject(const Value *V) {
if (CE->getOpcode() == Instruction::Cast ||
CE->getOpcode() == Instruction::GetElementPtr)
return getUnderlyingObject(CE->getOperand(0));
- } else if (const ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(V)) {
- return CPR->getValue();
}
return 0;
}