RFR(XS): 8211451: ~2.5% regression on compression benchmark starting with 12-b11

Vladimir Kozlov vladimir.kozlov at oracle.com
Fri Oct 12 15:37:10 UTC 2018


I am not sure it is correct. You can go into infinite loop with overflow with stride (> 1) which jump over the value you 
compare with.

Can we change !is_counted_loop_cmp(cmp) check for general loop check !is_loop_cmp(cmp) instead?

Thanks,
Vladimir

On 10/12/18 5:17 AM, Roland Westrelin wrote:
> 
> http://cr.openjdk.java.net/~roland/8211451/webrev.00/
> 
> The Compressor::output() method has a loop for which the exit condition
> is transformed by code added for 8209544:
> 
>    if ((_test._test == BoolTest::eq || _test._test == BoolTest::ne) &&
>        cop == Op_CmpI &&
>        cmp1_op == Op_AddI &&
>        cmp1->in(2) != NULL &&
>        phase->type(cmp1->in(2))->isa_int() &&
>        phase->type(cmp1->in(2))->is_int()->is_con() &&
>        cmp2_type == TypeInt::ZERO &&
>        !is_counted_loop_cmp(cmp) // modifying the exit test of a counted loop messes the counted loop shape
>        ) {
>      const TypeInt* cmp1_in2 = phase->type(cmp1->in(2))->is_int();
>      Node *ncmp = phase->transform( new CmpINode(cmp1->in(1),phase->intcon(-cmp1_in2->_hi)));
>      return new BoolNode( ncmp, _test._test );
>    }
> 
> That loop is then not transformed into a counted loop because of the
> following test in PhaseIdealLoop::is_counted_loop():
> 
>    if (phi_incr != NULL) {
>      // check if there is a possiblity of IV overflowing after the first increment
>      if (stride_con > 0) {
>        if (init_t->_hi > max_jint - stride_con) {
>          return false;
>        }
>      } else {
>        if (init_t->_lo < min_jint - stride_con) {
>          return false;
>        }
>      }
>    }
> 
> I think the logic above does not apply when the exit condition is an
> equality test because there's no risk of overflow leading to an
> incorrect test result.
> 
> Roland.
> 


More information about the hotspot-compiler-dev mailing list