< prev index next >

src/hotspot/share/opto/split_if.cpp

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "opto/callnode.hpp"
  28 #include "opto/loopnode.hpp"
  29 #include "opto/movenode.hpp"

  30 
  31 
  32 //------------------------------split_thru_region------------------------------
  33 // Split Node 'n' through merge point.
  34 Node *PhaseIdealLoop::split_thru_region( Node *n, Node *region ) {
  35   uint wins = 0;
  36   assert( n->is_CFG(), "" );
  37   assert( region->is_Region(), "" );
  38   Node *r = new RegionNode( region->req() );
  39   IdealLoopTree *loop = get_loop( n );
  40   for( uint i = 1; i < region->req(); i++ ) {
  41     Node *x = n->clone();
  42     Node *in0 = n->in(0);
  43     if( in0->in(0) == region ) x->set_req( 0, in0->in(i) );
  44     for( uint j = 1; j < n->req(); j++ ) {
  45       Node *in = n->in(j);
  46       if( get_ctrl(in) == region )
  47         x->set_req( j, in->in(i) );
  48     }
  49     _igvn.register_new_node_with_optimizer(x);


 177         set_ctrl(load,blk1);
 178     }
 179   }
 180 
 181   // Found some other Node; must clone it up
 182 #ifndef PRODUCT
 183   if( PrintOpto && VerifyLoopOptimizations ) {
 184     tty->print("Cloning up: ");
 185     n->dump();
 186   }
 187 #endif
 188 
 189   // ConvI2L may have type information on it which becomes invalid if
 190   // it moves up in the graph so change any clones so widen the type
 191   // to TypeLong::INT when pushing it up.
 192   const Type* rtype = NULL;
 193   if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::INT) {
 194     rtype = TypeLong::INT;
 195   }
 196 









 197   // Now actually split-up this guy.  One copy per control path merging.
 198   assert(!n->is_ValueType(), "value types should not be split through phis");
 199   Node *phi = PhiNode::make_blank(blk1, n);
 200   for( uint j = 1; j < blk1->req(); j++ ) {
 201     Node *x = n->clone();
 202     // Widen the type of the ConvI2L when pushing up.
 203     if (rtype != NULL) x->as_Type()->set_type(rtype);
 204     if( n->in(0) && n->in(0) == blk1 )
 205       x->set_req( 0, blk1->in(j) );
 206     for( uint i = 1; i < n->req(); i++ ) {
 207       Node *m = n->in(i);
 208       if( get_ctrl(m) == blk1 ) {
 209         assert( m->in(0) == blk1, "" );
 210         x->set_req( i, m->in(j) );
 211       }
 212     }
 213     register_new_node( x, blk1->in(j) );
 214     phi->init_req( j, x );
 215   }
 216   // Announce phi to optimizer
 217   register_new_node(phi, blk1);
 218 




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "opto/callnode.hpp"
  28 #include "opto/loopnode.hpp"
  29 #include "opto/movenode.hpp"
  30 #include "opto/valuetypenode.hpp"
  31 
  32 
  33 //------------------------------split_thru_region------------------------------
  34 // Split Node 'n' through merge point.
  35 Node *PhaseIdealLoop::split_thru_region( Node *n, Node *region ) {
  36   uint wins = 0;
  37   assert( n->is_CFG(), "" );
  38   assert( region->is_Region(), "" );
  39   Node *r = new RegionNode( region->req() );
  40   IdealLoopTree *loop = get_loop( n );
  41   for( uint i = 1; i < region->req(); i++ ) {
  42     Node *x = n->clone();
  43     Node *in0 = n->in(0);
  44     if( in0->in(0) == region ) x->set_req( 0, in0->in(i) );
  45     for( uint j = 1; j < n->req(); j++ ) {
  46       Node *in = n->in(j);
  47       if( get_ctrl(in) == region )
  48         x->set_req( j, in->in(i) );
  49     }
  50     _igvn.register_new_node_with_optimizer(x);


 178         set_ctrl(load,blk1);
 179     }
 180   }
 181 
 182   // Found some other Node; must clone it up
 183 #ifndef PRODUCT
 184   if( PrintOpto && VerifyLoopOptimizations ) {
 185     tty->print("Cloning up: ");
 186     n->dump();
 187   }
 188 #endif
 189 
 190   // ConvI2L may have type information on it which becomes invalid if
 191   // it moves up in the graph so change any clones so widen the type
 192   // to TypeLong::INT when pushing it up.
 193   const Type* rtype = NULL;
 194   if (n->Opcode() == Op_ConvI2L && n->bottom_type() != TypeLong::INT) {
 195     rtype = TypeLong::INT;
 196   }
 197 
 198   // Value types should not be split through Phis but each value input
 199   // needs to be merged individually. At this point, value types should
 200   // only be used by AllocateNodes. Try to remove redundant allocations
 201   // and unlink the now dead value type node.
 202   if (n->is_ValueType()) {
 203     n->as_ValueType()->remove_redundant_allocations(&_igvn, this);
 204     return true; // n is now dead
 205   }
 206 
 207   // Now actually split-up this guy.  One copy per control path merging.

 208   Node *phi = PhiNode::make_blank(blk1, n);
 209   for( uint j = 1; j < blk1->req(); j++ ) {
 210     Node *x = n->clone();
 211     // Widen the type of the ConvI2L when pushing up.
 212     if (rtype != NULL) x->as_Type()->set_type(rtype);
 213     if( n->in(0) && n->in(0) == blk1 )
 214       x->set_req( 0, blk1->in(j) );
 215     for( uint i = 1; i < n->req(); i++ ) {
 216       Node *m = n->in(i);
 217       if( get_ctrl(m) == blk1 ) {
 218         assert( m->in(0) == blk1, "" );
 219         x->set_req( i, m->in(j) );
 220       }
 221     }
 222     register_new_node( x, blk1->in(j) );
 223     phi->init_req( j, x );
 224   }
 225   // Announce phi to optimizer
 226   register_new_node(phi, blk1);
 227 


< prev index next >