RFR: 8367341: C2: apply KnownBits and unsigned bounds to And / Or operations [v3]
Emanuel Peter
epeter at openjdk.org
Tue Oct 28 10:16:08 UTC 2025
On Wed, 15 Oct 2025 16:15:05 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 incrementally with two additional commits since the last revision:
>
> - remove std::hash
> - remove unordered_map, add some comments for all_instances_size
Nice, that looks better already. Just looked over the diff, now going to look at the whole patch again.
test/hotspot/gtest/opto/test_rangeinference.cpp line 285:
> 283: // Quick helper for the tediousness below
> 284: auto f = [](auto x, auto y) {
> 285: return x < y ? RBTreeOrdering::LT : RBTreeOrdering::GT;
Suggestion:
assert(x != y, "we only handle lt and gt cases");
return x < y ? RBTreeOrdering::LT : RBTreeOrdering::GT;
Would that be correct?
-------------
PR Review: https://git.openjdk.org/jdk/pull/27618#pullrequestreview-3387858662
PR Review Comment: https://git.openjdk.org/jdk/pull/27618#discussion_r2468878934
More information about the hotspot-dev
mailing list