< prev index next >

src/share/vm/opto/loopTransform.cpp

Print this page




1293 
1294       if (limit->is_Con()) {
1295         // The check in policy_unroll and the assert above guarantee
1296         // no underflow if limit is constant.
1297         new_limit = _igvn.intcon(limit->get_int() - stride_con);
1298         set_ctrl(new_limit, C->root());
1299       } else {
1300         // Limit is not constant.
1301         if (loop_head->unrolled_count() == 1) { // only for first unroll
1302           // Separate limit by Opaque node in case it is an incremented
1303           // variable from previous loop to avoid using pre-incremented
1304           // value which could increase register pressure.
1305           // Otherwise reorg_offsets() optimization will create a separate
1306           // Opaque node for each use of trip-counter and as result
1307           // zero trip guard limit will be different from loop limit.
1308           assert(has_ctrl(opaq), "should have it");
1309           Node* opaq_ctrl = get_ctrl(opaq);
1310           limit = new (C) Opaque2Node( C, limit );
1311           register_new_node( limit, opaq_ctrl );
1312         }
1313         if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) ||
1314                    stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) {
1315           // No underflow.
1316           new_limit = new (C) SubINode(limit, stride);
1317         } else {
1318           // (limit - stride) may underflow.
1319           // Clamp the adjustment value with MININT or MAXINT:
1320           //
1321           //   new_limit = limit-stride
1322           //   if (stride > 0)
1323           //     new_limit = (limit < new_limit) ? MININT : new_limit;
1324           //   else
1325           //     new_limit = (limit > new_limit) ? MAXINT : new_limit;
1326           //
1327           BoolTest::mask bt = loop_end->test_trip();
1328           assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected");
1329           Node* adj_max = _igvn.intcon((stride_con > 0) ? min_jint : max_jint);
1330           set_ctrl(adj_max, C->root());
1331           Node* old_limit = NULL;
1332           Node* adj_limit = NULL;
1333           Node* bol = limit->is_CMove() ? limit->in(CMoveNode::Condition) : NULL;
1334           if (loop_head->unrolled_count() > 1 &&




1293 
1294       if (limit->is_Con()) {
1295         // The check in policy_unroll and the assert above guarantee
1296         // no underflow if limit is constant.
1297         new_limit = _igvn.intcon(limit->get_int() - stride_con);
1298         set_ctrl(new_limit, C->root());
1299       } else {
1300         // Limit is not constant.
1301         if (loop_head->unrolled_count() == 1) { // only for first unroll
1302           // Separate limit by Opaque node in case it is an incremented
1303           // variable from previous loop to avoid using pre-incremented
1304           // value which could increase register pressure.
1305           // Otherwise reorg_offsets() optimization will create a separate
1306           // Opaque node for each use of trip-counter and as result
1307           // zero trip guard limit will be different from loop limit.
1308           assert(has_ctrl(opaq), "should have it");
1309           Node* opaq_ctrl = get_ctrl(opaq);
1310           limit = new (C) Opaque2Node( C, limit );
1311           register_new_node( limit, opaq_ctrl );
1312         }
1313         if (stride_con > 0 && (java_subtract(limit_type->_lo, stride_con) < limit_type->_lo) ||
1314             stride_con < 0 && (java_subtract(limit_type->_hi, stride_con) > limit_type->_hi)) {
1315           // No underflow.
1316           new_limit = new (C) SubINode(limit, stride);
1317         } else {
1318           // (limit - stride) may underflow.
1319           // Clamp the adjustment value with MININT or MAXINT:
1320           //
1321           //   new_limit = limit-stride
1322           //   if (stride > 0)
1323           //     new_limit = (limit < new_limit) ? MININT : new_limit;
1324           //   else
1325           //     new_limit = (limit > new_limit) ? MAXINT : new_limit;
1326           //
1327           BoolTest::mask bt = loop_end->test_trip();
1328           assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected");
1329           Node* adj_max = _igvn.intcon((stride_con > 0) ? min_jint : max_jint);
1330           set_ctrl(adj_max, C->root());
1331           Node* old_limit = NULL;
1332           Node* adj_limit = NULL;
1333           Node* bol = limit->is_CMove() ? limit->in(CMoveNode::Condition) : NULL;
1334           if (loop_head->unrolled_count() > 1 &&


< prev index next >