[llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp CallGraph.cpp FindUsedTypes.cpp GlobalsModRef.cpp
LLVM
llvm at cs.uiuc.edu
Sat Jul 17 17:18:40 PDT 2004
Changes in directory llvm/lib/Analysis/IPA:
Andersens.cpp updated: 1.4 -> 1.5
CallGraph.cpp updated: 1.37 -> 1.38
FindUsedTypes.cpp updated: 1.28 -> 1.29
GlobalsModRef.cpp updated: 1.1 -> 1.2
---
Log message:
bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass
---
Diffs of the changes: (+12 -15)
Index: llvm/lib/Analysis/IPA/Andersens.cpp
diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.4 llvm/lib/Analysis/IPA/Andersens.cpp:1.5
--- llvm/lib/Analysis/IPA/Andersens.cpp:1.4 Thu Jun 24 23:24:22 2004
+++ llvm/lib/Analysis/IPA/Andersens.cpp Sat Jul 17 19:18:30 2004
@@ -479,8 +479,8 @@
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 @@
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:
Index: llvm/lib/Analysis/IPA/CallGraph.cpp
diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.37 llvm/lib/Analysis/IPA/CallGraph.cpp:1.38
--- llvm/lib/Analysis/IPA/CallGraph.cpp:1.37 Sun May 2 11:06:18 2004
+++ llvm/lib/Analysis/IPA/CallGraph.cpp Sat Jul 17 19:18:30 2004
@@ -73,10 +73,8 @@
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)))
Index: llvm/lib/Analysis/IPA/FindUsedTypes.cpp
diff -u llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.28 llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.29
--- llvm/lib/Analysis/IPA/FindUsedTypes.cpp:1.28 Wed Jul 14 21:31:46 2004
+++ llvm/lib/Analysis/IPA/FindUsedTypes.cpp Sat Jul 17 19:18:30 2004
@@ -48,9 +48,10 @@
// 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);
}
}
Index: llvm/lib/Analysis/IPA/GlobalsModRef.cpp
diff -u llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.1 llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.2
--- llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.1 Mon Jun 28 01:33:13 2004
+++ llvm/lib/Analysis/IPA/GlobalsModRef.cpp Sat Jul 17 19:18:30 2004
@@ -165,8 +165,8 @@
} 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 @@
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;
}
More information about the llvm-commits
mailing list