RFR: 8279947: Remove two redundant gvn.transform calls in Parse::do_one_bytecode()

Jie Fu jiefu at openjdk.java.net
Thu Jan 13 06:27:22 UTC 2022


On Thu, 13 Jan 2022 04:28:53 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> Second `transform()` was replacement for `precision_rounding()` in [JDK-4416902](https://bugs.openjdk.java.net/browse/JDK-4416902) fix.
> 
> ```
>    case Bytecodes::_l2f:
>      a = pop_pair(); 
>      b = _gvn.transform( new (2) ConvL2FNode(a));
> -    c = precision_rounding(b);
> +    // For i486.ad, FILD doesn't restrict precision to 24 or 53 bits.
> +    // Rather than storing the result into an FP register then pushing
> +    // out to memory to round, the machine instruction that implements
> +    // ConvL2D is responsible for rounding.
> +    // c = precision_rounding(b);
> +    c = _gvn.transform(b);
>      push(c);
>      break;
> ```
> 
> I think it was not necessary because main fix was done in x86_32.ad file by using `FSTP_S/FSTP_D` instructions to do correct rounding:
> 
> ```
> -instruct convL2F_reg( regF dst, eRegL src) %{
> +instruct convL2F_reg( stackSlotF dst, eRegL src) %{
>    match(Set dst (ConvL2F src));
> ...
> -  ins_encode(convert_long_double(src), Pop_Reg_F(dst));
> +  ins_encode(convert_long_double(src), Pop_Mem_F(dst));
> ```

Thanks @vnkozlov for your review and comments.

But how `precision_rounding()` can be replaced with `transform()` ?

I think for the following three code snippets, c, c2 and c3 should be the same.

b = _gvn.transform( new ConvL2FNode(a));
c = _gvn.transform(b);                    <===>  c2 = _gvn.transform(_gvn.transform( new ConvL2FNode(a)));  <===>  c3 = _gvn.transform( new ConvL2FNode(a));


So I think this pr won't change C2's behavior even for 32-bit VMs.
Do you think so?
Thanks.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7059


More information about the hotspot-compiler-dev mailing list