src/share/vm/opto/loopTransform.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8148754-cr Sdiff src/share/vm/opto

src/share/vm/opto/loopTransform.cpp

Print this page




1445   // if rounds of unroll,optimize are making progress
1446   loop_head->set_node_count_before_unroll(loop->_body.size());
1447 
1448   Node *ctrl  = loop_head->in(LoopNode::EntryControl);
1449   Node *limit = loop_head->limit();
1450   Node *init  = loop_head->init_trip();
1451   Node *stride = loop_head->stride();
1452 
1453   Node *opaq = NULL;
1454   if (adjust_min_trip) {       // If not maximally unrolling, need adjustment
1455     // Search for zero-trip guard.
1456     assert( loop_head->is_main_loop(), "" );
1457     assert( ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "" );
1458     Node *iff = ctrl->in(0);
1459     assert( iff->Opcode() == Op_If, "" );
1460     Node *bol = iff->in(1);
1461     assert( bol->Opcode() == Op_Bool, "" );
1462     Node *cmp = bol->in(1);
1463     assert( cmp->Opcode() == Op_CmpI, "" );
1464     opaq = cmp->in(2);
1465     // Occasionally it's possible for a zero-trip guard Opaque1 node to be
1466     // optimized away and then another round of loop opts attempted.
1467     // We can not optimize this particular loop in that case.
1468     if (opaq->Opcode() != Op_Opaque1)
1469       return; // Cannot find zero-trip guard!  Bail out!
1470     // Zero-trip test uses an 'opaque' node which is not shared.
1471     assert(opaq->outcnt() == 1 && opaq->in(1) == limit, "");
1472   }
1473 
1474   C->set_major_progress();
1475 
1476   Node* new_limit = NULL;
1477   if (UnrollLimitCheck) {
1478     int stride_con = stride->get_int();
1479     int stride_p = (stride_con > 0) ? stride_con : -stride_con;
1480     uint old_trip_count = loop_head->trip_count();
1481     // Verify that unroll policy result is still valid.
1482     assert(old_trip_count > 1 &&
1483            (!adjust_min_trip || stride_p <= (1<<3)*loop_head->unrolled_count()), "sanity");
1484 
1485     // Adjust loop limit to keep valid iterations number after unroll.
1486     // Use (limit - stride) instead of (((limit - init)/stride) & (-2))*stride
1487     // which may overflow.
1488     if (!adjust_min_trip) {
1489       assert(old_trip_count > 1 && (old_trip_count & 1) == 0,




1445   // if rounds of unroll,optimize are making progress
1446   loop_head->set_node_count_before_unroll(loop->_body.size());
1447 
1448   Node *ctrl  = loop_head->in(LoopNode::EntryControl);
1449   Node *limit = loop_head->limit();
1450   Node *init  = loop_head->init_trip();
1451   Node *stride = loop_head->stride();
1452 
1453   Node *opaq = NULL;
1454   if (adjust_min_trip) {       // If not maximally unrolling, need adjustment
1455     // Search for zero-trip guard.
1456     assert( loop_head->is_main_loop(), "" );
1457     assert( ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "" );
1458     Node *iff = ctrl->in(0);
1459     assert( iff->Opcode() == Op_If, "" );
1460     Node *bol = iff->in(1);
1461     assert( bol->Opcode() == Op_Bool, "" );
1462     Node *cmp = bol->in(1);
1463     assert( cmp->Opcode() == Op_CmpI, "" );
1464     opaq = cmp->in(2);
1465     assert(opaq->Opcode() == Op_Opaque1, "");




1466     // Zero-trip test uses an 'opaque' node which is not shared.
1467     assert(opaq->outcnt() == 1 && opaq->in(1) == limit, "");
1468   }
1469 
1470   C->set_major_progress();
1471 
1472   Node* new_limit = NULL;
1473   if (UnrollLimitCheck) {
1474     int stride_con = stride->get_int();
1475     int stride_p = (stride_con > 0) ? stride_con : -stride_con;
1476     uint old_trip_count = loop_head->trip_count();
1477     // Verify that unroll policy result is still valid.
1478     assert(old_trip_count > 1 &&
1479            (!adjust_min_trip || stride_p <= (1<<3)*loop_head->unrolled_count()), "sanity");
1480 
1481     // Adjust loop limit to keep valid iterations number after unroll.
1482     // Use (limit - stride) instead of (((limit - init)/stride) & (-2))*stride
1483     // which may overflow.
1484     if (!adjust_min_trip) {
1485       assert(old_trip_count > 1 && (old_trip_count & 1) == 0,


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