[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructureStats.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Sep 20 11:14:00 PDT 2003
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructureStats.cpp updated: 1.4 -> 1.5
---
Log message:
Make this work better for constants that aren't necessarily in ANY graph, such as null pointers
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/DataStructureStats.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.4 llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.5
--- llvm/lib/Analysis/DataStructure/DataStructureStats.cpp:1.4 Fri Sep 19 20:20:46 2003
+++ llvm/lib/Analysis/DataStructure/DataStructureStats.cpp Sat Sep 20 11:12:57 2003
@@ -33,6 +33,7 @@
const DSGraph *TDGraph;
DSNode *getNodeForValue(Value *V);
+ bool isNodeForValueCollapsed(Value *V);
public:
/// Driver functions to compute the Load/Store Dep. Graph per function.
bool runOnFunction(Function& F);
@@ -90,14 +91,24 @@
DSNode *DSGraphStats::getNodeForValue(Value *V) {
const DSGraph *G = TDGraph;
- if (isa<GlobalValue>(V))
+ if (isa<GlobalValue>(V) || isa<Constant>(V))
G = TDGraph->getGlobalsGraph();
- return G->getNodeForValue(V).getNode();
+ const DSGraph::ScalarMapTy &ScalarMap = G->getScalarMap();
+ DSGraph::ScalarMapTy::const_iterator I = ScalarMap.find(V);
+ if (I != ScalarMap.end())
+ return I->second.getNode();
+ return 0;
+}
+
+bool DSGraphStats::isNodeForValueCollapsed(Value *V) {
+ if (DSNode *N = getNodeForValue(V))
+ return N->isNodeCompletelyFolded();
+ return false;
}
void DSGraphStats::visitLoad(LoadInst &LI) {
- if (getNodeForValue(LI.getOperand(0))->isNodeCompletelyFolded()) {
+ if (isNodeForValueCollapsed(LI.getOperand(0))) {
NumUntypedMemAccesses++;
} else {
NumTypedMemAccesses++;
@@ -105,7 +116,7 @@
}
void DSGraphStats::visitStore(StoreInst &SI) {
- if (getNodeForValue(SI.getOperand(1))->isNodeCompletelyFolded()) {
+ if (isNodeForValueCollapsed(SI.getOperand(1))) {
NumUntypedMemAccesses++;
} else {
NumTypedMemAccesses++;
More information about the llvm-commits
mailing list