1382
1383 if (limit->is_Con()) {
1384 // The check in policy_unroll and the assert above guarantee
1385 // no underflow if limit is constant.
1386 new_limit = _igvn.intcon(limit->get_int() - stride_con);
1387 set_ctrl(new_limit, C->root());
1388 } else {
1389 // Limit is not constant.
1390 if (loop_head->unrolled_count() == 1) { // only for first unroll
1391 // Separate limit by Opaque node in case it is an incremented
1392 // variable from previous loop to avoid using pre-incremented
1393 // value which could increase register pressure.
1394 // Otherwise reorg_offsets() optimization will create a separate
1395 // Opaque node for each use of trip-counter and as result
1396 // zero trip guard limit will be different from loop limit.
1397 assert(has_ctrl(opaq), "should have it");
1398 Node* opaq_ctrl = get_ctrl(opaq);
1399 limit = new Opaque2Node( C, limit );
1400 register_new_node( limit, opaq_ctrl );
1401 }
1402 if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) ||
1403 stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) {
1404 // No underflow.
1405 new_limit = new SubINode(limit, stride);
1406 } else {
1407 // (limit - stride) may underflow.
1408 // Clamp the adjustment value with MININT or MAXINT:
1409 //
1410 // new_limit = limit-stride
1411 // if (stride > 0)
1412 // new_limit = (limit < new_limit) ? MININT : new_limit;
1413 // else
1414 // new_limit = (limit > new_limit) ? MAXINT : new_limit;
1415 //
1416 BoolTest::mask bt = loop_end->test_trip();
1417 assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected");
1418 Node* adj_max = _igvn.intcon((stride_con > 0) ? min_jint : max_jint);
1419 set_ctrl(adj_max, C->root());
1420 Node* old_limit = NULL;
1421 Node* adj_limit = NULL;
1422 Node* bol = limit->is_CMove() ? limit->in(CMoveNode::Condition) : NULL;
1423 if (loop_head->unrolled_count() > 1 &&
|
1382
1383 if (limit->is_Con()) {
1384 // The check in policy_unroll and the assert above guarantee
1385 // no underflow if limit is constant.
1386 new_limit = _igvn.intcon(limit->get_int() - stride_con);
1387 set_ctrl(new_limit, C->root());
1388 } else {
1389 // Limit is not constant.
1390 if (loop_head->unrolled_count() == 1) { // only for first unroll
1391 // Separate limit by Opaque node in case it is an incremented
1392 // variable from previous loop to avoid using pre-incremented
1393 // value which could increase register pressure.
1394 // Otherwise reorg_offsets() optimization will create a separate
1395 // Opaque node for each use of trip-counter and as result
1396 // zero trip guard limit will be different from loop limit.
1397 assert(has_ctrl(opaq), "should have it");
1398 Node* opaq_ctrl = get_ctrl(opaq);
1399 limit = new Opaque2Node( C, limit );
1400 register_new_node( limit, opaq_ctrl );
1401 }
1402 if (stride_con > 0 && (java_subtract(limit_type->_lo, stride_con) < limit_type->_lo) ||
1403 stride_con < 0 && (java_subtract(limit_type->_hi, stride_con) > limit_type->_hi)) {
1404 // No underflow.
1405 new_limit = new SubINode(limit, stride);
1406 } else {
1407 // (limit - stride) may underflow.
1408 // Clamp the adjustment value with MININT or MAXINT:
1409 //
1410 // new_limit = limit-stride
1411 // if (stride > 0)
1412 // new_limit = (limit < new_limit) ? MININT : new_limit;
1413 // else
1414 // new_limit = (limit > new_limit) ? MAXINT : new_limit;
1415 //
1416 BoolTest::mask bt = loop_end->test_trip();
1417 assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected");
1418 Node* adj_max = _igvn.intcon((stride_con > 0) ? min_jint : max_jint);
1419 set_ctrl(adj_max, C->root());
1420 Node* old_limit = NULL;
1421 Node* adj_limit = NULL;
1422 Node* bol = limit->is_CMove() ? limit->in(CMoveNode::Condition) : NULL;
1423 if (loop_head->unrolled_count() > 1 &&
|