RFR: 8281453: New optimization: convert `~x` into `-1-x` when `~x` is used in an arithmetic expression [v12]
Quan Anh Mai
qamai at openjdk.org
Thu Sep 29 19:21:22 UTC 2022
On Thu, 29 Sep 2022 17:40:11 GMT, Zhiqiang Zang <duke at openjdk.org> wrote:
>> In that case, you would need to check the `Opcode` of the use similar to the above line. However, I believe that since you have already deferred the transformation, the bitwise transformations should have been finished by then so you don't need to worry about that. I would suggest adding a comment to remind this. And some tests to confirm, such as `(x + y) & ~(x + y) == 0`. Thanks.
>
> Thanks. I agree transformation like `(x + y) & ~(x + y) => 0` should have been covered by idealization from `AndINode` at this point. However, my intention was to catch the case like `return ~(x-1) => return -x`. If we have only line 889 we would not be able to do this because `~(x - 1)` is not used in arithmetic and will not be transformed.
I mean you don't need `outcnt() == 1`.
-------------
PR: https://git.openjdk.org/jdk/pull/7376
More information about the hotspot-compiler-dev
mailing list