comparison src/share/vm/opto/loopnode.cpp @ 3782:aacaff365100

7052494: Eclipse test fails on JDK 7 b142 Summary: Keep 'ne' test in Counted loop when we can't guarantee during compilation that init < limit. Reviewed-by: never
author kvn
date Mon, 20 Jun 2011 16:45:35 -0700
parents bad7ecd0b6ed
children c96c3eb1efae
comparison
equal deleted inserted replaced
3781:d83ac25d0304 3782:aacaff365100
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.