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: Resolved
  • Resolution: Fixed
  • Submitted: 2025-09-10
  • Updated: 2026-01-05
  • Resolved: 2025-12-18
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.
JDK 27
27 b03Fixed
Related Reports
Causes :  
Causes :  
Relates :  
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
Changeset: e6780506 Branch: master Author: Quan Anh Mai <qamai@openjdk.org> Date: 2025-12-18 07:31:06 +0000 URL: https://git.openjdk.org/jdk/commit/e67805067a8f537862200e808e20464f12d21c9c
18-12-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/27618 Date: 2025-10-03 06:07:50 +0000
03-10-2025

[~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