JDK-8304049 : C2 can not merge trivial Ifs due to CastII
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2023-03-13
  • Updated: 2023-03-15
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 :  
Description
C2 can not apply Split If for the following trivial case. After a quick investigation, CastII generated by Parse::sharpen_type_after_if prevents it from being optimized out, because PhiNode::Identity can not find existing Cmp if we don't allow cast(unique_input(n,false/*uncast*/))

  public static void test5(int a, int b){
 
    if( b!=0) {
      int_field = 35;
    } else {
      int_field =222;
    }

    if( b!=0) {
      int_field = 35;
    } else {
      int_field =222;
    }
  }
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/13039 Date: 2023-03-15 10:37:03 +0000
15-03-2023