RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v4]
Johannes Graham
duke at openjdk.org
Thu Jan 23 16:31:46 UTC 2025
On Thu, 23 Jan 2025 16:17:35 GMT, Johannes Graham <duke at openjdk.org> wrote:
>> src/hotspot/share/opto/addnode.cpp line 1003:
>>
>>> 1001: (r0->_hi > 0) &&
>>> 1002: (r1->_lo >= 0) &&
>>> 1003: (r1->_hi > 0)) {
>>
>> This can be simplified to:
>>
>> if (r0->_lo >= 0 && r1->_lo >= 0)
>>
>> There is no need to check `_hi` here.
>
>> There is no need to check `_hi` here.
>
> If hi=0, then round_down_power_of_2(hi) would be a problem. Though if both lo and hi are 0, then it'd be a constant and wouldn't get here - is that the idea?
If one arg was (lo=0,hi=1) and the other was 0 though, it might be a problem. Depends where x ^ 0 gets simplified.
*edit* Your alternative version below avoids this concern.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1927282376
More information about the hotspot-compiler-dev
mailing list