< prev index next >

src/hotspot/share/opto/loopopts.cpp

Print this page




 865 
 866             // Disconnect the phi now. An empty phi can confuse other
 867             // optimizations in this pass of loop opts..
 868             if (phi->in(LoopNode::LoopBackControl) == phi) {
 869               _igvn.replace_node(phi, phi->in(LoopNode::EntryControl));
 870               n_loop->_body.yank(phi);
 871             }
 872           }
 873         }
 874       }
 875     }
 876   }
 877 }
 878 
 879 //------------------------------split_if_with_blocks_pre-----------------------
 880 // Do the real work in a non-recursive function.  Data nodes want to be
 881 // cloned in the pre-order so they can feed each other nicely.
 882 Node *PhaseIdealLoop::split_if_with_blocks_pre( Node *n ) {
 883   // Cloning these guys is unlikely to win
 884   int n_op = n->Opcode();
 885 
 886   if( n_op == Op_MergeMem ) return n;
 887   if( n->is_Proj() ) return n;
 888   // Do not clone-up CmpFXXX variations, as these are always
 889   // followed by a CmpI
 890   if( n->is_Cmp() ) return n;
 891   // Attempt to use a conditional move instead of a phi/branch
 892   if( ConditionalMoveLimit > 0 && n_op == Op_Region ) {
 893     Node *cmov = conditional_move( n );
 894     if( cmov ) return cmov;
 895   }
 896 
 897   if (n->is_CFG() || n->is_LoadStore()) {
 898     return n;
 899   }
 900   if( n_op == Op_Opaque1 ||     // Opaque nodes cannot be mod'd
 901       n_op == Op_Opaque2 ) {
 902     if( !C->major_progress() )   // If chance of no more loop opts...
 903       _igvn._worklist.push(n);  // maybe we'll remove them
 904     return n;
 905   }
 906 
 907   if( n->is_Con() ) return n;   // No cloning for Con nodes
 908 
 909   Node *n_ctrl = get_ctrl(n);
 910   if( !n_ctrl ) return n;       // Dead node
 911 
 912   Node* res = try_move_store_before_loop(n, n_ctrl);
 913   if (res != NULL) {
 914     return n;
 915   }
 916 
 917   // Attempt to remix address expressions for loop invariants
 918   Node *m = remix_address_expressions( n );
 919   if( m ) return m;


1538         bolphi->init_req(i, con_false);
1539       }
1540     }
1541     register_new_node(bolphi, n_ctrl);
1542     _igvn.replace_input_of(n, 1, bolphi);
1543 
1544     // Now split the IF
1545     do_split_if(n);
1546     return;
1547   }
1548 
1549   // Check for an IF ready to split; one that has its
1550   // condition codes input coming from a Phi at the block start.
1551   int n_op = n->Opcode();
1552 
1553   // Check for an IF being dominated by another IF same test
1554   if (n_op == Op_If ||
1555       n_op == Op_RangeCheck) {
1556     Node *bol = n->in(1);
1557     uint max = bol->outcnt();
1558 
1559     // Check for same test used more than once?
1560     if (max > 1 && bol->is_Bool()) {
1561       // Search up IDOMs to see if this IF is dominated.
1562       Node *cutoff = get_ctrl(bol);
1563 
1564       // Now search up IDOMs till cutoff, looking for a dominating test
1565       Node *prevdom = n;
1566       Node *dom = idom(prevdom);
1567       while (dom != cutoff) {
1568         if (dom->req() > 1 && dom->in(1) == bol && prevdom->in(0) == dom) {
1569           // Replace the dominated test with an obvious true or false.
1570           // Place it on the IGVN worklist for later cleanup.
1571           C->set_major_progress();
1572           dominated_by(prevdom, n, false, true);
1573 #ifndef PRODUCT
1574           if( VerifyLoopOptimizations ) verify();
1575 #endif
1576           return;
1577         }
1578         prevdom = dom;




 865 
 866             // Disconnect the phi now. An empty phi can confuse other
 867             // optimizations in this pass of loop opts..
 868             if (phi->in(LoopNode::LoopBackControl) == phi) {
 869               _igvn.replace_node(phi, phi->in(LoopNode::EntryControl));
 870               n_loop->_body.yank(phi);
 871             }
 872           }
 873         }
 874       }
 875     }
 876   }
 877 }
 878 
 879 //------------------------------split_if_with_blocks_pre-----------------------
 880 // Do the real work in a non-recursive function.  Data nodes want to be
 881 // cloned in the pre-order so they can feed each other nicely.
 882 Node *PhaseIdealLoop::split_if_with_blocks_pre( Node *n ) {
 883   // Cloning these guys is unlikely to win
 884   int n_op = n->Opcode();

 885   if( n_op == Op_MergeMem ) return n;
 886   if( n->is_Proj() ) return n;
 887   // Do not clone-up CmpFXXX variations, as these are always
 888   // followed by a CmpI
 889   if( n->is_Cmp() ) return n;
 890   // Attempt to use a conditional move instead of a phi/branch
 891   if( ConditionalMoveLimit > 0 && n_op == Op_Region ) {
 892     Node *cmov = conditional_move( n );
 893     if( cmov ) return cmov;
 894   }
 895   if( n->is_CFG() || n->is_LoadStore() )

 896     return n;

 897   if( n_op == Op_Opaque1 ||     // Opaque nodes cannot be mod'd
 898       n_op == Op_Opaque2 ) {
 899     if( !C->major_progress() )   // If chance of no more loop opts...
 900       _igvn._worklist.push(n);  // maybe we'll remove them
 901     return n;
 902   }
 903 
 904   if( n->is_Con() ) return n;   // No cloning for Con nodes
 905 
 906   Node *n_ctrl = get_ctrl(n);
 907   if( !n_ctrl ) return n;       // Dead node
 908 
 909   Node* res = try_move_store_before_loop(n, n_ctrl);
 910   if (res != NULL) {
 911     return n;
 912   }
 913 
 914   // Attempt to remix address expressions for loop invariants
 915   Node *m = remix_address_expressions( n );
 916   if( m ) return m;


1535         bolphi->init_req(i, con_false);
1536       }
1537     }
1538     register_new_node(bolphi, n_ctrl);
1539     _igvn.replace_input_of(n, 1, bolphi);
1540 
1541     // Now split the IF
1542     do_split_if(n);
1543     return;
1544   }
1545 
1546   // Check for an IF ready to split; one that has its
1547   // condition codes input coming from a Phi at the block start.
1548   int n_op = n->Opcode();
1549 
1550   // Check for an IF being dominated by another IF same test
1551   if (n_op == Op_If ||
1552       n_op == Op_RangeCheck) {
1553     Node *bol = n->in(1);
1554     uint max = bol->outcnt();

1555     // Check for same test used more than once?
1556     if (max > 1 && bol->is_Bool()) {
1557       // Search up IDOMs to see if this IF is dominated.
1558       Node *cutoff = get_ctrl(bol);
1559 
1560       // Now search up IDOMs till cutoff, looking for a dominating test
1561       Node *prevdom = n;
1562       Node *dom = idom(prevdom);
1563       while (dom != cutoff) {
1564         if (dom->req() > 1 && dom->in(1) == bol && prevdom->in(0) == dom) {
1565           // Replace the dominated test with an obvious true or false.
1566           // Place it on the IGVN worklist for later cleanup.
1567           C->set_major_progress();
1568           dominated_by(prevdom, n, false, true);
1569 #ifndef PRODUCT
1570           if( VerifyLoopOptimizations ) verify();
1571 #endif
1572           return;
1573         }
1574         prevdom = dom;


< prev index next >