Would gatekeeper help review this patch?

https://bugs.open64.net/show_bug.cgi?id=767
Nystrom alias issue: 456.gobmk base output difference on train data

The wrong alias is caused in
ConstraintGraphNode::collapseTypeIncompatibleNodes.
It try to collpase a kid node's parent node into kid.

In ConstraintGraphNode::collapse(cur), collpase node cur into this.

  // Merge cur with 'this' node
  ConstraintGraphNode *curParent = cur->parent();

  // When merging, merge with 'this's parent
  ConstraintGraphNode *thisParent = this->parent();

  if (curParent != thisParent) {   // skip merging here because parent are
same
    thisParent->merge(curParent);
    curParent->repParent(thisParent);
  }

  // When cur's parent is merged with this, we might have transfered
  // a parent copy edge from cur's parent to cur, which needs to be removed
  cur->deleteInOutEdges();  // delete all edges here


Problem is no merge happen in this case, but node cur's all edge is deleted.

Fix is
1. In ConstraintGraphNode::collapseTypeIncompatibleNodes, if collpased node
is parent of collapsed target, switch the collapse node and target node.
2. add assertion ConstraintGraphNode::collapse, node cur is not parent of
node this.

Index: osprey/be/com/constraint_graph.cxx
===================================================================
--- osprey/be/com/constraint_graph.cxx  (revision 3575)
+++ osprey/be/com/constraint_graph.cxx  (working copy)
@@ -3194,6 +3194,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();
@@ -4333,6 +4335,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


Regards
Shi ,Hui
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to