aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/Local.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-07-18 00:18:30 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-07-18 00:18:30 +0000
commite840434755e2165ac20ec55e9d5ff3d2defac2d2 (patch)
tree546353c849d6137556b5dfb7e90d317a7c37b42c /lib/Analysis/DataStructure/Local.cpp
parente0125b678539029091e70695cf4219ec2c297a25 (diff)
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage - Minimize redundant isa<GlobalValue> usage - Correct isa<Constant> for GlobalValue subclass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14942 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Local.cpp')
-rw-r--r--lib/Analysis/DataStructure/Local.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index 865c14480a..7836555c29 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/lib/Analysis/DataStructure/Local.cpp
@@ -220,10 +220,13 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) {
// Otherwise we need to create a new node to point to.
// Check first for constant expressions that must be traversed to
// extract the actual value.
- if (Constant *C = dyn_cast<Constant>(V))
- if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(C)) {
- return NH = getValueDest(*CPR->getValue());
- } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
+ DSNode* N;
+ if (GlobalValue* GV = dyn_cast<GlobalValue>(V)) {
+ // Create a new global node for this global variable...
+ N = createNode(GV->getType()->getElementType());
+ N->addGlobal(GV);
+ } else if (Constant *C = dyn_cast<Constant>(V)) {
+ if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
if (CE->getOpcode() == Instruction::Cast)
NH = getValueDest(*CE->getOperand(0));
else if (CE->getOpcode() == Instruction::GetElementPtr) {
@@ -247,13 +250,7 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) {
} else {
assert(0 && "Unknown constant type!");
}
-
- // Otherwise we need to create a new node to point to...
- DSNode *N;
- if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
- // Create a new global node for this global variable...
- N = createNode(GV->getType()->getElementType());
- N->addGlobal(GV);
+ N = createNode(); // just create a shadow node
} else {
// Otherwise just create a shadow node
N = createNode();
@@ -491,8 +488,6 @@ void GraphBuilder::visitInvokeInst(InvokeInst &II) {
void GraphBuilder::visitCallSite(CallSite CS) {
Value *Callee = CS.getCalledValue();
- if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Callee))
- Callee = CPR->getValue();
// Special case handling of certain libc allocation functions here.
if (Function *F = dyn_cast<Function>(Callee))