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

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 21 18:55:00 PST 2004


Changes in directory llvm/lib/Analysis/DataStructure:

DataStructure.cpp updated: 1.157 -> 1.158

---
Log message:

Use isNull instead of getNode() to test for existence of a node, this is cheaper.

FIX MAJOR BUG, whereby we didn't merge null edges correctly. Correcting this
fixes poolallocation on 175.vpr, and possibly others.


---
Diffs of the changes:  (+11 -6)

Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.157 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.158
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.157	Sat Feb 21 16:28:26 2004
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Sat Feb 21 18:53:54 2004
@@ -845,7 +845,7 @@
   // been cloned.
   const DSNode *SN = SrcNH.getNode();
   DSNodeHandle &SCNH = NodeMap[SN];  // SourceClonedNodeHandle
-  if (SCNH.getNode()) {   // Node already cloned?
+  if (!SCNH.isNull()) {   // Node already cloned?
     NH.mergeWith(DSNodeHandle(SCNH.getNode(),
                               SCNH.getOffset()+SrcNH.getOffset()));
 
@@ -971,10 +971,15 @@
       if (CN->getSize() != 1)
         MergeOffset = ((i << DS::PointerShift)+SCNH.getOffset()) %CN->getSize();
       
-      // Perform the recursive merging.  Make sure to create a temporary NH,
-      // because the Link can disappear in the process of recursive merging.
-      DSNodeHandle Tmp = CN->getLink(MergeOffset);
-      merge(Tmp, SrcEdge);
+      DSNodeHandle &Link = CN->getLink(MergeOffset);
+      if (!Link.isNull()) {
+        // Perform the recursive merging.  Make sure to create a temporary NH,
+        // because the Link can disappear in the process of recursive merging.
+        DSNodeHandle Tmp = Link;
+        merge(Tmp, SrcEdge);
+      } else {
+        merge(Link, SrcEdge);
+      }
     }
   }
 }
@@ -1214,7 +1219,7 @@
     }
     
     // Map the return node pointer over.
-    if (CS.getRetVal().getNode())
+    if (!CS.getRetVal().isNull())
       RC.merge(CS.getRetVal(), Graph.getReturnNodeFor(F));
     
     // If requested, copy the calls or aux-calls lists.





More information about the llvm-commits mailing list