Author: shihui
Date: 2011-05-11 04:02:17 -0400 (Wed, 11 May 2011)
New Revision: 3594

Modified:
   trunk/osprey/be/com/constraint_graph.cxx
Log:
Fix bug 767

The problem is nystrom alias collpase parent node into its kid.
This will losing edges recorded on parent nodes.
Because no real merge happens in this case and all collaposed node's edge is 
removed.
 
Fix is
1. In ConstraintGraphNode::collapseTypeIncompatibleNodes, if collpased node is 
parent of collapsed target, switch the collapse node and target node.
2. In StInfo::applyModulus, avoid collpase parent into its kid cg node.
3. add assertion ConstraintGraphNode::collapse, node cur is not parent of node 
this.

Code review by Jianxin 



Modified: trunk/osprey/be/com/constraint_graph.cxx
===================================================================
--- trunk/osprey/be/com/constraint_graph.cxx    2011-05-10 19:42:51 UTC (rev 
3593)
+++ trunk/osprey/be/com/constraint_graph.cxx    2011-05-11 08:02:17 UTC (rev 
3594)
@@ -586,6 +586,15 @@
 
       if (modNode->checkFlags(CG_NODE_FLAGS_COLLAPSED))
         modNode = ConstraintGraph::cgNode(modNode->collapsedParent());
+
+      // can't collapse parent into its kid, missing edges
+      // switch parent relation between cur and modNode
+      if (modNode->parent() == cur) {
+        modNode->clearFlags(CG_NODE_FLAGS_MERGED);
+        modNode->repParent(NULL);
+        modNode->merge(cur);
+        cur->repParent(modNode);
+      }
         
       // Now we collapse cur into modNode
       modNode->collapse(cur);
@@ -3222,6 +3231,8 @@
             ("Not expecting this node: %d to be collasped", id()));
   FmtAssert(!cur->checkFlags(CG_NODE_FLAGS_COLLAPSED), 
             ("Not expecting cur node: %d to be collasped", cur->id()));
+  FmtAssert(parent() != cur,
+            ("Not expecting cur node be parent of this "));
 
   // Merge cur with 'this' node
   ConstraintGraphNode *curParent = cur->parent();
@@ -4361,6 +4372,12 @@
         FmtAssert(ptdNode->stInfo()->firstOffset()->nextOffset() == NULL,
                   ("Only single offset expected"));
         ptdNode = ptdNode->stInfo()->firstOffset();
+        // can't collapse node's parent to its self.
+        if (ptdNode == repNode->parent()) {
+          ConstraintGraphNode *tmp = ptdNode;
+          ptdNode = repNode;
+          repNode = tmp;
+        }
         // SparseBitSetIterator caches ids when iterating. So of the 'effect'
         // of collapsing is not immediately visible, in which case we might
         // encounter collapsed nodes when iterating the pts


------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to