summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-22 02:45:13 +0000
committerChris Lattner <sabre@nondot.org>2005-03-22 02:45:13 +0000
commita513fb127f579b43cd954d028e4bf0581dd65907 (patch)
treee6074579fff360b7ec96a86991a96ffadf747682 /lib/Analysis
parent9308a35532bb756cc03edbdc2deeea6f2d3ed1ed (diff)
Remove an iteration pass over the entire scalarmap for each function created
by not allowing integer constants to get into the scalar map in the first place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20764 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/DataStructure/Local.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index 6db075f5fce..cf8f8f4bab2 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/lib/Analysis/DataStructure/Local.cpp
@@ -82,7 +82,8 @@ namespace {
FunctionCalls(&fc) {
// Create scalar nodes for all pointer arguments...
- for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end(); I != E; ++I)
+ for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end();
+ I != E; ++I)
if (isPointerType(I->getType()))
getValueDest(*I);
@@ -177,13 +178,6 @@ DSGraph::DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &td,
Timer::addPeakMemoryMeasurement();
#endif
- // Remove all integral constants from the scalarmap!
- for (DSScalarMap::iterator I = ScalarMap.begin(); I != ScalarMap.end();)
- if (isa<ConstantIntegral>(I->first))
- ScalarMap.erase(I++);
- else
- ++I;
-
// If there are any constant globals referenced in this function, merge their
// initializers into the local graph from the globals graph.
if (ScalarMap.global_begin() != ScalarMap.global_end()) {
@@ -228,9 +222,12 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) {
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) {
+ if (CE->getOpcode() == Instruction::Cast) {
+ if (isa<PointerType>(CE->getOperand(0)->getType()))
+ NH = getValueDest(*CE->getOperand(0));
+ else
+ NH = createNode()->setUnknownNodeMarker();
+ } else if (CE->getOpcode() == Instruction::GetElementPtr) {
visitGetElementPtrInst(*CE);
DSScalarMap::iterator I = ScalarMap.find(CE);
assert(I != ScalarMap.end() && "GEP didn't get processed right?");
@@ -244,10 +241,6 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) {
return 0;
}
return NH;
-
- } else if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(C)) {
- // Random constants are unknown mem
- return NH = createNode()->setUnknownNodeMarker();
} else if (isa<UndefValue>(C)) {
ScalarMap.erase(V);
return 0;