RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v46]
Quan Anh Mai
qamai at openjdk.org
Tue Apr 1 02:17:14 UTC 2025
On Mon, 31 Mar 2025 22:28:49 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> Johannes Graham has updated the pull request incrementally with one additional commit since the last revision:
>>
>> add missing import
>
> Thanks.
>
>> The naming of that method evolved during the course of the review of this PR. I believe the thinking was that the check was not necessarily an overall upper bound, and a simpler name would imply it was more general.
>
> There's usually a lot of invariants a function assumes and it's simply impractical to encode everything in the name. Speaking of this particular case (`calc_xor_upper_bound_of_non_neg`):
> * `calc_` is redundant and IMO only adds noise;
> * `_non_neg` part is confusing; I'd stress instead that it works on **ranges**.
>
> So, `xor_upper_bound_for_ranges` then? (And, please, explain in the comment what's the correspondense between `S` and `U` template type parameters.)
>
>> `addnodeXorUtil.hpp`
>
> I'm fine with placing it under `opto`. Please, rename the file into `src/hotspot/share/opto/utilities/xor.hpp`.
@iwanowww
> `_non_neg` part is confusing; I'd stress instead that it works on ranges.
I find it easier to think of it as calculating the upperbound of the xor of 2 non-negative integers whose upperbounds are given in the parameters.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23089#issuecomment-2767875213
More information about the hotspot-compiler-dev
mailing list