[llvm-commits] [poolalloc] r123534 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Sat Jan 15 01:42:52 PST 2011
Author: aggarwa4
Date: Sat Jan 15 03:42:52 2011
New Revision: 123534
URL: http://llvm.org/viewvc/llvm-project?rev=123534&view=rev
Log:
Always check if a DSGraph has a DSNode for a Value.
Use hasNodeForValue to check for node,
instead of getNodeForValue which
creates a new node if one does not exist.
Modified:
poolalloc/trunk/lib/DSA/StdLibPass.cpp
Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=123534&r1=123533&r2=123534&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original)
+++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Sat Jan 15 03:42:52 2011
@@ -374,18 +374,18 @@
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.read[y])
if (isa<PointerType>(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
- Node->setReadMarker();
+ if (Graph->hasNodeForValue(CI->getOperand(y)))
+ Graph->getNodeForValue(CI->getOperand(y)).getNode()->setReadMarker();
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.write[y])
if (isa<PointerType>(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
- Node->setModifiedMarker();
+ if (Graph->hasNodeForValue(CI->getOperand(y)))
+ Graph->getNodeForValue(CI->getOperand(y)).getNode()->setModifiedMarker();
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.heap[y])
if (isa<PointerType>(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
- Node->setHeapMarker();
+ if (Graph->hasNodeForValue(CI->getOperand(y)))
+ Graph->getNodeForValue(CI->getOperand(y)).getNode()->setHeapMarker();
//
// Merge the DSNoes for return values and parameters as
@@ -397,7 +397,8 @@
if (recFuncs[x].action.mergeAllArgs || recFuncs[x].action.mergeWithRet)
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (isa<PointerType>(CI->getOperand(y)->getType()))
- toMerge.push_back(Graph->getNodeForValue(CI->getOperand(y)));
+ if (Graph->hasNodeForValue(CI->getOperand(y)))
+ toMerge.push_back(Graph->getNodeForValue(CI->getOperand(y)));
for (unsigned y = 1; y < toMerge.size(); ++y)
toMerge[0].mergeWith(toMerge[y]);
@@ -412,8 +413,8 @@
}
for (unsigned y = 1; y < CI->getNumOperands(); ++y){
if (isa<PointerType>(CI->getOperand(y)->getType())){
- if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode()){
- Node->foldNodeCompletely();
+ if (Graph->hasNodeForValue(CI->getOperand(y))){
+ Graph->getNodeForValue(CI->getOperand(y)).getNode()->foldNodeCompletely();
NumNodesFoldedInStdLib++;
}
}
@@ -446,18 +447,18 @@
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.read[y])
if (isa<PointerType>(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
- Node->setReadMarker();
+ if (Graph->hasNodeForValue(CI->getOperand(y)))
+ Graph->getNodeForValue(CI->getOperand(y)).getNode()->setReadMarker();
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.write[y])
if (isa<PointerType>(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
- Node->setModifiedMarker();
+ if (Graph->hasNodeForValue(CI->getOperand(y)))
+ Graph->getNodeForValue(CI->getOperand(y)).getNode()->setModifiedMarker();
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (recFuncs[x].action.heap[y])
if (isa<PointerType>(CI->getOperand(y)->getType()))
- if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
- Node->setHeapMarker();
+ if (Graph->hasNodeForValue(CI->getOperand(y)))
+ Graph->getNodeForValue(CI->getOperand(y)).getNode()->setHeapMarker();
//
// Merge the DSNoes for return values and parameters as
@@ -469,7 +470,8 @@
if (recFuncs[x].action.mergeAllArgs || recFuncs[x].action.mergeWithRet)
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (isa<PointerType>(CI->getOperand(y)->getType()))
- toMerge.push_back(Graph->getNodeForValue(CI->getOperand(y)));
+ if (Graph->hasNodeForValue(CI->getOperand(y)))
+ toMerge.push_back(Graph->getNodeForValue(CI->getOperand(y)));
for (unsigned y = 1; y < toMerge.size(); ++y)
toMerge[0].mergeWith(toMerge[y]);
@@ -484,7 +486,8 @@
}
for (unsigned y = 1; y < CI->getNumOperands(); ++y)
if (isa<PointerType>(CI->getOperand(y)->getType())){
- if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode()){
+ if (Graph->hasNodeForValue(CI->getOperand(y))){
+ DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode();
Node->foldNodeCompletely();
NumNodesFoldedInStdLib++;
}
More information about the llvm-commits
mailing list