451 } |
451 } |
452 |
452 |
453 // Now we need to canonicalize loop condition. |
453 // Now we need to canonicalize loop condition. |
454 if (bt == BoolTest::ne) { |
454 if (bt == BoolTest::ne) { |
455 assert(stride_con == 1 || stride_con == -1, "simple increment only"); |
455 assert(stride_con == 1 || stride_con == -1, "simple increment only"); |
456 bt = (stride_con > 0) ? BoolTest::lt : BoolTest::gt; |
456 // 'ne' can be replaced with 'lt' only when init < limit. |
|
457 if (stride_con > 0 && init_t->_hi < limit_t->_lo) |
|
458 bt = BoolTest::lt; |
|
459 // 'ne' can be replaced with 'gt' only when init > limit. |
|
460 if (stride_con < 0 && init_t->_lo > limit_t->_hi) |
|
461 bt = BoolTest::gt; |
457 } |
462 } |
458 |
463 |
459 if (incl_limit) { |
464 if (incl_limit) { |
460 // The limit check guaranties that 'limit <= (max_jint - stride)' so |
465 // The limit check guaranties that 'limit <= (max_jint - stride)' so |
461 // we can convert 'i <= limit' to 'i < limit+1' since stride != 0. |
466 // we can convert 'i <= limit' to 'i < limit+1' since stride != 0. |