RFR(S): 8143542: C2 doesn't eliminate identical checks
Vladimir Kozlov
vladimir.kozlov at oracle.com
Wed Feb 3 18:00:26 UTC 2016
Yes, this looks good.
Thanks,
Vladimir
On 2/3/16 4:01 AM, Roland Westrelin wrote:
> http://cr.openjdk.java.net/~roland/8143542/webrev.00/
>
> The test case:
>
> https://bugs.openjdk.java.net/secure/attachment/55176/RedundantNullCheck.java
>
> has two identical tests one after the other:
>
> int ret = 0;
> if (_i != null) {
> ret += _i.value();
> } else {
> ret += -1;
> }
> if (_i != null) {
> ret += _i.value2();
> } else {
> ret += -1;
> }
>
> They can be merged. I picky backed on the split if code to achieve that. Both inlined calls have a null check and a range check. For them to fold nicely after the ifs are merged, ConstraintCastNode::dominating_cast() needs to more aggressively look for redundant casts.
>
> Roland.
>
More information about the hotspot-compiler-dev
mailing list