RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v27]

Emanuel Peter epeter at openjdk.org
Thu Feb 13 09:53:15 UTC 2025


On Thu, 13 Feb 2025 09:24:59 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/opto/addnode.cpp line 986:
>> 
>>> 984: 
>>> 985: template<class S, class U>
>>> 986: static S calc_xor_max(const S hi_0, const S hi_1) {
>> 
>> Can we please have a more expressive name? Having `max` in the name can be a little confusing, as it is its own operation, which is not relevant here it seems. What we are really finding is the `hi` of the type after the `xor`. So why not name it `calculate_hi_after_xor`?
>
> I think the name is good enough, calculate the max of a xor is a pretty self-explanatory name. You just need a better description for the method. Suggestion:
> 
>     Given 2 non-negative values in the ranges [0, hi_0] and [0, hi_1], respectively. The bitwise xor of these values should also be non-negative. This method calculates its maximum.

What about calling it `calculate_upper_bound_of_xor_with_non_negative_inputs`?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1954177610


More information about the hotspot-compiler-dev mailing list