C2 can not merge trivial Ifs due to CastII

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 21
    • Component/s: hotspot

      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;
          }
        }

            Assignee:
            Yi Yang
            Reporter:
            Yi Yang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: