Relates :
|
|
Relates :
|
|
Relates :
|
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;
|