[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Jan 22 10:32:02 PST 2004


Changes in directory llvm/lib/Analysis/DataStructure:

DataStructure.cpp updated: 1.132 -> 1.133

---
Log message:

Bug fix:  X.mergeWith(Y) was not updating Y if Y  was a null node handle!


---
Diffs of the changes:  (+9 -2)

Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.132 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.133
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.132	Thu Jan 22 09:30:58 2004
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Thu Jan 22 10:31:08 2004
@@ -679,12 +679,19 @@
 // Offset indicates what offset the specified node is to be merged into the
 // current node.
 //
-// The specified node may be a null pointer (in which case, nothing happens).
+// The specified node may be a null pointer (in which case, we update it to
+// point to this node).
 //
 void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) {
   DSNode *N = NH.getNode();
-  if (N == 0 || (N == this && NH.getOffset() == Offset))
+  if (N == this && NH.getOffset() == Offset)
     return;  // Noop
+
+  // If the RHS is a null node, make it point to this node!
+  if (N == 0) {
+    NH.mergeWith(DSNodeHandle(this, Offset));
+    return;
+  }
 
   assert(!N->isDeadNode() && !isDeadNode());
   assert(!hasNoReferrers() && "Should not try to fold a useless node!");





More information about the llvm-commits mailing list