JDK-8367341 : C2: apply KnownBits and unsigned bounds to And / Or operations
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 26
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-09-10
  • Updated: 2025-09-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
After JDK-8315066, we should apply especially the KnownBits to And / Or nodes.

Feel free to file more RFE's for the other ideas, if you only want to do KnownBits for And / Or.

This would help us generate more KnownBit patterns in the first place, and then it also helps us verify KnownBit types by extracting bits.

Without, it is a bit hard to generate good tests for optimizations that already use KnownBits.

A somewhat related concern: we should have a good way to restrict values on the unsigned range. Maybe some unsigned min/max node, or at least cast after unsigned comparison? Maybe that already works, would just be nice to know so we can use it in verification. Also related to JDK-8359412.

It would have been really helpful to already have in JDK-8365205, and will be helpful in any further KnownBits optimizations.
Comments
[~qamai] Thanks for taking this on! But let's do the gtest framework in a separate RFE ;)
13-09-2025

Let me take this, I want to implement a gtest framework for arithmetic operations in general, too.
10-09-2025

[~qamai] [~hgreule] Are either of you interested?
10-09-2025

I'm going on vacation soon, so feel free to assign it to yourself if you work on it soon.
10-09-2025