RFR: 8367341: C2: apply KnownBits and unsigned bounds to And / Or operations
    Hannes Greule 
    hgreule at openjdk.org
       
    Mon Oct  6 13:29:53 UTC 2025
    
    
  
On Fri, 3 Oct 2025 06:07:50 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.
Nice change overall.
I'm not sure how "easily" we can really see the benefit in the example of the interval splitting, but I leave that to others to judge.
I was just wondering, do you think it makes sense to move more such code into the RangeInference classes in future (e.g., for shift ops) or how we'll tell what to place where. From what it looks like the main reason currently is to use the TypeIntMirror classes for testability, which other node types definitely could benefit from as well.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27618#pullrequestreview-3304640558
    
    
More information about the hotspot-compiler-dev
mailing list