RFR: 8367341: C2: apply KnownBits and unsigned bounds to And / Or operations [v7]

Hannes Greule hgreule at openjdk.org
Tue Dec 16 07:12:59 UTC 2025


On Sun, 7 Dec 2025 12:08:18 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> Hi,
>> 
>> This PR improves the implementation of `AndNode/OrNode/XorNode::Value` by taking advantages of the additional information in `TypeInt`. The implementation is pretty straightforward. A clever trick is that by analyzing the negative and positive ranges of a `TypeInt` separately, we have better info for the leading bits. I also implement gtest unit tests to verify the correctness and monotonicity of the inference functions.
>> 
>> Please take a look and leave your reviews, thanks a lot.
>
> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
> 
>  - Merge branch 'master' into andorxor
>  - Merge branch 'master' into andorxor
>  - Merge branch 'master' into andorxor
>  - Add assertion for the helper in CTPComparator
>    
>    Co-authored-by: Emanuel Peter <emanuel.peter at oracle.com>
>  - remove std::hash
>  - remove unordered_map, add some comments for all_instances_size
>  - Emanuel's reviews
>  - Improve Value inferences of And, Or, Xor and implement gtest for general Value inferences

Not sure if my review counts but I went through the changes again and it looks like all existing inference logic is covered by the more concise and also more powerful new logic.

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

Marked as reviewed by hgreule (Committer).

PR Review: https://git.openjdk.org/jdk/pull/27618#pullrequestreview-3581649461


More information about the hotspot-dev mailing list