7052494: Eclipse test fails on JDK 7 b142

Keep 'ne' test in Counted loop when we can't guarantee during compilation that init < limit.

Reviewed-by: never
This commit is contained in:
Vladimir Kozlov 2011-06-20 16:45:35 -07:00
parent 5d2e4e676b
commit d19a8f6e35
3 changed files with 172 additions and 3 deletions

View file

@ -453,7 +453,12 @@ bool PhaseIdealLoop::is_counted_loop( Node *x, IdealLoopTree *loop ) {
// Now we need to canonicalize loop condition.
if (bt == BoolTest::ne) {
assert(stride_con == 1 || stride_con == -1, "simple increment only");
bt = (stride_con > 0) ? BoolTest::lt : BoolTest::gt;
// 'ne' can be replaced with 'lt' only when init < limit.
if (stride_con > 0 && init_t->_hi < limit_t->_lo)
bt = BoolTest::lt;
// 'ne' can be replaced with 'gt' only when init > limit.
if (stride_con < 0 && init_t->_lo > limit_t->_hi)
bt = BoolTest::gt;
}
if (incl_limit) {