src/share/vm/opto/phaseX.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6866651 Sdiff src/share/vm/opto

src/share/vm/opto/phaseX.cpp

Print this page




 966   ensure_type_or_null(n);
 967   if (type_or_null(n) == NULL) {
 968     set_type_bottom(n);
 969   }
 970 
 971   return transform_old(n);
 972 }
 973 
 974 //------------------------------transform_old----------------------------------
 975 Node *PhaseIterGVN::transform_old( Node *n ) {
 976 #ifndef PRODUCT
 977   debug_only(uint loop_count = 0;);
 978   set_transforms();
 979 #endif
 980   // Remove 'n' from hash table in case it gets modified
 981   _table.hash_delete(n);
 982   if( VerifyIterativeGVN ) {
 983    assert( !_table.find_index(n->_idx), "found duplicate entry in table");
 984   }
 985 











 986   // Apply the Ideal call in a loop until it no longer applies
 987   Node *k = n;
 988   DEBUG_ONLY(dead_loop_check(k);)
 989   DEBUG_ONLY(bool is_new = (k->outcnt() == 0);)
 990   Node *i = k->Ideal(this, /*can_reshape=*/true);
 991   assert(i != k || is_new || i->outcnt() > 0, "don't return dead nodes");
 992 #ifndef PRODUCT
 993   if( VerifyIterativeGVN )
 994     verify_step(k);
 995   if( i && VerifyOpto ) {
 996     if( !allow_progress() ) {
 997       if (i->is_Add() && i->outcnt() == 1) {
 998         // Switched input to left side because this is the only use
 999       } else if( i->is_If() && (i->in(0) == NULL) ) {
1000         // This IF is dead because it is dominated by an equivalent IF When
1001         // dominating if changed, info is not propagated sparsely to 'this'
1002         // Propagating this info further will spuriously identify other
1003         // progress.
1004         return i;
1005       } else


1605 
1606 //------------------------------print_statistics-------------------------------
1607 #ifndef PRODUCT
1608 void PhasePeephole::print_statistics() {
1609   tty->print_cr("Peephole: peephole rules applied: %d",  _total_peepholes);
1610 }
1611 #endif
1612 
1613 
1614 //=============================================================================
1615 //------------------------------set_req_X--------------------------------------
1616 void Node::set_req_X( uint i, Node *n, PhaseIterGVN *igvn ) {
1617   assert( is_not_dead(n), "can not use dead node");
1618   assert( igvn->hash_find(this) != this, "Need to remove from hash before changing edges" );
1619   Node *old = in(i);
1620   set_req(i, n);
1621 
1622   // old goes dead?
1623   if( old ) {
1624     switch (old->outcnt()) {
1625     case 0:      // Kill all his inputs, and recursively kill other dead nodes.


1626       if (!old->is_top())
1627         igvn->remove_dead_node( old );
1628       break;
1629     case 1:
1630       if( old->is_Store() || old->has_special_unique_user() )
1631         igvn->add_users_to_worklist( old );
1632       break;
1633     case 2:
1634       if( old->is_Store() )
1635         igvn->add_users_to_worklist( old );
1636       if( old->Opcode() == Op_Region )
1637         igvn->_worklist.push(old);
1638       break;
1639     case 3:
1640       if( old->Opcode() == Op_Region ) {
1641         igvn->_worklist.push(old);
1642         igvn->add_users_to_worklist( old );
1643       }
1644       break;
1645     default:
1646       break;
1647     }




 966   ensure_type_or_null(n);
 967   if (type_or_null(n) == NULL) {
 968     set_type_bottom(n);
 969   }
 970 
 971   return transform_old(n);
 972 }
 973 
 974 //------------------------------transform_old----------------------------------
 975 Node *PhaseIterGVN::transform_old( Node *n ) {
 976 #ifndef PRODUCT
 977   debug_only(uint loop_count = 0;);
 978   set_transforms();
 979 #endif
 980   // Remove 'n' from hash table in case it gets modified
 981   _table.hash_delete(n);
 982   if( VerifyIterativeGVN ) {
 983    assert( !_table.find_index(n->_idx), "found duplicate entry in table");
 984   }
 985 
 986   // If n computes a constant, replace it with a constant now to skip unneeded
 987   // ideal transformations
 988   const Type* t_n = type_or_null(n);
 989   if( t_n != NULL && t_n->singleton() && !n->is_Con() ) {
 990     NOT_PRODUCT( set_progress(); )
 991     Node *con = makecon(t_n);     // Make a constant
 992     add_users_to_worklist( n );
 993     subsume_node( n, con );     // Everybody using n now uses con
 994     return con;
 995   }
 996 
 997   // Apply the Ideal call in a loop until it no longer applies
 998   Node *k = n;
 999   DEBUG_ONLY(dead_loop_check(k);)
1000   DEBUG_ONLY(bool is_new = (k->outcnt() == 0);)
1001   Node *i = k->Ideal(this, /*can_reshape=*/true);
1002   assert(i != k || is_new || i->outcnt() > 0, "don't return dead nodes");
1003 #ifndef PRODUCT
1004   if( VerifyIterativeGVN )
1005     verify_step(k);
1006   if( i && VerifyOpto ) {
1007     if( !allow_progress() ) {
1008       if (i->is_Add() && i->outcnt() == 1) {
1009         // Switched input to left side because this is the only use
1010       } else if( i->is_If() && (i->in(0) == NULL) ) {
1011         // This IF is dead because it is dominated by an equivalent IF When
1012         // dominating if changed, info is not propagated sparsely to 'this'
1013         // Propagating this info further will spuriously identify other
1014         // progress.
1015         return i;
1016       } else


1616 
1617 //------------------------------print_statistics-------------------------------
1618 #ifndef PRODUCT
1619 void PhasePeephole::print_statistics() {
1620   tty->print_cr("Peephole: peephole rules applied: %d",  _total_peepholes);
1621 }
1622 #endif
1623 
1624 
1625 //=============================================================================
1626 //------------------------------set_req_X--------------------------------------
1627 void Node::set_req_X( uint i, Node *n, PhaseIterGVN *igvn ) {
1628   assert( is_not_dead(n), "can not use dead node");
1629   assert( igvn->hash_find(this) != this, "Need to remove from hash before changing edges" );
1630   Node *old = in(i);
1631   set_req(i, n);
1632 
1633   // old goes dead?
1634   if( old ) {
1635     switch (old->outcnt()) {
1636     case 0:
1637       // Put into the worklist to kill later. We do not kill it now because the
1638       // recursive kill will delete the current node (this) if dead-loop exists
1639       if (!old->is_top())
1640         igvn->_worklist.push( old );
1641       break;
1642     case 1:
1643       if( old->is_Store() || old->has_special_unique_user() )
1644         igvn->add_users_to_worklist( old );
1645       break;
1646     case 2:
1647       if( old->is_Store() )
1648         igvn->add_users_to_worklist( old );
1649       if( old->Opcode() == Op_Region )
1650         igvn->_worklist.push(old);
1651       break;
1652     case 3:
1653       if( old->Opcode() == Op_Region ) {
1654         igvn->_worklist.push(old);
1655         igvn->add_users_to_worklist( old );
1656       }
1657       break;
1658     default:
1659       break;
1660     }


src/share/vm/opto/phaseX.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File