JDK-8350864 : C2: verify structural invariants of the Ideal graph
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-02-27
  • Updated: 2025-04-10
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 :  
Relates :  
Description
Add a debug-only verification pass that asserts that C2's Ideal graph is "well-formed" by checking basic, local invariants (e.g. control nodes (CFG nodes) can have multiple data node users but only one control node user, phi nodes must have an input region, If nodes must have two projections, etc.). This pass could be run at different steps of C2's compilation chain, e.g. after each IGVN pass.

Other example candidate invariants can be found at https://github.com/openjdk/jdk/blob/master/src/utils/IdealGraphVisualizer/ServerCompiler/src/main/java/com/sun/hotspot/igv/servercompiler/ServerCompilerScheduler.java (IGV checks some of these invariants while approximating the CFG).
Comments
About "If nodes must have two projections", we already have this bailout here that catches this: https://github.com/openjdk/jdk/blob/d6d94472c21b1fa4839f548b85908967057c3f07/src/hotspot/share/opto/compile.cpp#L3975-L3978 We used to have an assert here but it fired too many times with Java Fuzzer due to missing Assertion Predicates. I'm planning to reestablish the assert once the complete fix is in. Anyhow, I think it still would be good to catch this malformed If earlier with some separate verification as suggested in this RFE.
27-02-2025