[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Oct 31 16:42:00 PST 2002
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructure.cpp updated: 1.36 -> 1.37
---
Log message:
* Minor optimization: when merging nodes, merge the smaller one into the
larger one.
* Handle the case where we are merging two nodes of different size better.
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.36 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.37
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.36 Wed Oct 30 23:45:02 2002
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Thu Oct 31 16:41:15 2002
@@ -355,7 +355,7 @@
// now completely folded.
//
if (isNodeCompletelyFolded()) {
- NH.getNode()->foldNodeCompletely();
+ N->foldNodeCompletely();
} else if (NH.getNode()->isNodeCompletelyFolded()) {
foldNodeCompletely();
Offset = 0;
@@ -367,6 +367,10 @@
if (Offset > NH.getOffset()) {
N->mergeWith(DSNodeHandle(this, Offset), NH.getOffset());
return;
+ } else if (Offset == NH.getOffset() && getSize() < N->getSize()) {
+ // If the offsets are the same, merge the smaller node into the bigger node
+ N->mergeWith(DSNodeHandle(this, Offset), NH.getOffset());
+ return;
}
#if 0
@@ -381,9 +385,15 @@
//
unsigned NOffset = NH.getOffset()-Offset;
+ // If our destination node is too small... try to grow it.
+ if (N->getSize()+NOffset > getSize() &&
+ growNode(N->getSize()+NOffset)) {
+ // Catastrophic failure occured and we had to collapse the node. In this
+ // case, collapse the other node as well.
+ N->foldNodeCompletely();
+ NOffset = 0;
+ }
unsigned NSize = N->getSize();
- assert(NSize+NOffset <= getSize() &&
- "Don't know how to merge extend a merged nodes size yet!");
// Remove all edges pointing at N, causing them to point to 'this' instead.
// Make sure to adjust their offset, not just the node pointer.
More information about the llvm-commits
mailing list