Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8143542

C2 doesn't eliminate identical checks

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b108

      Description

      There are cases when C2 fails to remove redundant check (has identical dominating check).

      Reported by Vitaly Davidovich:
        http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2015-November/019930.html

      Final IR from attached test case:
      RedundantNullCheck::doIt() {
        w = Load this._w
        If (w == NULL) deopt
        i = Load w._i
        If (i != NULL) { // check #1
          If (!i instanceof C) deopt
        } v1 = Phi(T:1,F:-1);
        If (i != NULL) { // check #2
          If (!i instanceof C) deopt
        } v2 = Phi(T:2,F:-1)
        return v1+v2
      }

      Checks #1 & #2 are identical. #1 dominates #2, but C2 doesn't remove #2.

      Next transformations should be:
        w = Load this._w
        If (w == NULL) deopt
        i = Load w._i
        If (i != NULL) {
          If (!i instanceof C) deopt
          If (!i instanceof C) deopt
        } v1 = Phi(T:1,F:-1)
          v2 = Phi(T:2,F:-1)
        return v1+v2

      and

        w = Load this._w
        If (w == NULL) deopt
        i = Load w._i
        If (i != NULL) {
          If (!i instanceof C) deopt
        } v1 = Phi(T:1,F:-1)
          v2 = Phi(T:2,F:-1)
        return i1+i2;

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                roland Roland Westrelin
                Reporter:
                vlivanov Vladimir Ivanov
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: