RFR: 8281453: New optimization: convert `~x` into `-1-x` when `~x` is used in an arithmetic expression [v12]
Zhiqiang Zang
duke at openjdk.org
Thu Sep 29 15:09:37 UTC 2022
On Thu, 29 Sep 2022 14:36:49 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Zhiqiang Zang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> remove redundant tests.
>
> src/hotspot/share/opto/addnode.cpp line 891:
>
>> 889: if (is_used_in_only_arithmetic(this, T_INT)
>> 890: // used only once and contains arithmetic
>> 891: || (outcnt() == 1 && (in1->Opcode() == Op_AddI || in1->Opcode() == Op_SubI))) {
>
> May I ask why do you need `outcnt() == 1` here, thanks.
I was thinking of which cases we still want to transform even when the `Xornode` is used in a non-arithmetic expression, and the only case I think safe to transform is that when it is used only once and has some arithmetic inside, for example,
`return ~(x+c)`.
-------------
PR: https://git.openjdk.org/jdk/pull/7376
More information about the hotspot-compiler-dev
mailing list