< prev index next >

src/share/vm/opto/ifnode.cpp

Print this page




1513     prev_dom = dom;
1514     dom = up_one_dom( dom );
1515     if( !dom ) return NULL;
1516   }
1517 
1518   // Check that we did not follow a loop back to ourselves
1519   if( this == dom )
1520     return NULL;
1521 
1522   if( dist > 2 )              // Add to count of NULL checks elided
1523     explicit_null_checks_elided++;
1524 
1525   return prev_dom;
1526 }
1527 
1528 //------------------------------Identity---------------------------------------
1529 // If the test is constant & we match, then we are the input Control
1530 Node *IfProjNode::Identity(PhaseTransform *phase) {
1531   // Can only optimize if cannot go the other way
1532   const TypeTuple *t = phase->type(in(0))->is_tuple();
1533   if (t == TypeTuple::IFNEITHER ||
1534       // kill dead branch first otherwise the IfNode's control will
1535       // have 2 control uses (the IfNode that doesn't go away because
1536       // it still has uses and this branch of the
1537       // If). Node::has_special_unique_user() will cause this node to
1538       // be reprocessed once the dead branch is killed.
1539       (always_taken(t) && in(0)->outcnt() == 1)) {
1540     // IfNode control
1541     return in(0)->in(0);
1542   }
1543   // no progress
1544   return this;











1545 }
1546 
1547 #ifndef PRODUCT
1548 //-------------------------------related---------------------------------------
1549 // An IfProjNode's related node set consists of its input (an IfNode) including
1550 // the IfNode's condition, plus all of its outputs at level 1. In compact mode,
1551 // the restrictions for IfNode apply (see IfNode::rel).
1552 void IfProjNode::related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const {
1553   Node* ifNode = this->in(0);
1554   in_rel->append(ifNode);
1555   if (compact) {
1556     ifNode->collect_nodes(in_rel, 3, false, true);
1557   } else {
1558     ifNode->collect_nodes_in_all_data(in_rel, false);
1559   }
1560   this->collect_nodes(out_rel, -1, false, false);
1561 }
1562 
1563 //------------------------------dump_spec--------------------------------------
1564 void IfNode::dump_spec(outputStream *st) const {




1513     prev_dom = dom;
1514     dom = up_one_dom( dom );
1515     if( !dom ) return NULL;
1516   }
1517 
1518   // Check that we did not follow a loop back to ourselves
1519   if( this == dom )
1520     return NULL;
1521 
1522   if( dist > 2 )              // Add to count of NULL checks elided
1523     explicit_null_checks_elided++;
1524 
1525   return prev_dom;
1526 }
1527 
1528 //------------------------------Identity---------------------------------------
1529 // If the test is constant & we match, then we are the input Control
1530 Node *IfProjNode::Identity(PhaseTransform *phase) {
1531   // Can only optimize if cannot go the other way
1532   const TypeTuple *t = phase->type(in(0))->is_tuple();
1533   if (t == TypeTuple::IFNEITHER || always_taken(t)) {






1534     // IfNode control
1535     return in(0)->in(0);
1536   }
1537   // no progress
1538   return this;
1539 }
1540 
1541 Node* IfProjNode::Ideal(PhaseGVN* phase, bool can_reshape) {
1542   const Type* t = phase->type(in(0));
1543   if (can_reshape && in(0)->outcnt() == 2 && t != Type::TOP && always_taken(t->is_tuple())) {
1544     // Cut off dead branch if this branch is always taken
1545     Node* other = in(0)->as_If()->proj_out(!is_IfTrue());
1546     other->set_req(0, phase->C->top());
1547     return this;
1548   }
1549   return NULL;
1550 }
1551 
1552 #ifndef PRODUCT
1553 //-------------------------------related---------------------------------------
1554 // An IfProjNode's related node set consists of its input (an IfNode) including
1555 // the IfNode's condition, plus all of its outputs at level 1. In compact mode,
1556 // the restrictions for IfNode apply (see IfNode::rel).
1557 void IfProjNode::related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const {
1558   Node* ifNode = this->in(0);
1559   in_rel->append(ifNode);
1560   if (compact) {
1561     ifNode->collect_nodes(in_rel, 3, false, true);
1562   } else {
1563     ifNode->collect_nodes_in_all_data(in_rel, false);
1564   }
1565   this->collect_nodes(out_rel, -1, false, false);
1566 }
1567 
1568 //------------------------------dump_spec--------------------------------------
1569 void IfNode::dump_spec(outputStream *st) const {


< prev index next >