RFR(M): 8220376: C2: Int >0 not recognized as !=0 for div by 0 check

Patric Hedlin patric.hedlin at oracle.com
Fri Nov 15 09:28:23 UTC 2019


Thanks Vladimir for pointing this out.

The immediate reason is that this is a reduced patch derived from a more 
general one (addressing a few more cases and requiring some "surgery"). 
I thought I should put this out first (to address the very limited case 
in the trouble report) as I found the more general approach to grow a 
bit more than I was happy with (the intent being to follow-up with the 
more general version later). But you are absolutely right that this 
single case only requires a constant condition. I'll re-work the patch 
and save the "surgery" for later.

Best regards,
Patric Hedlin

On 14/11/2019 09:31, Vladimir Ivanov wrote:
>
>
>> Webrev: http://cr.openjdk.java.net/~phedlin/tr8220376/
>
> I just briefly looked through the patch and have a quick high-level 
> question:
>
> +  // Rewrite:
> +  //              cmp                   cmp
> +  //              / \                    |
> +  //     (r1)  bool  \                  bool (r1)
> +  //            /    bool (r2)            \
> +  //    (dom) if       \        ==>       if
> +  //            \       )                  \
> +  //    (pre)  if[TF]  /                  if[TF]X
> +  //               \  /
> +  //                if (this)
> +  //               /  \
> +  //             ifT  ifF [X]
>
> Why do you do complex graph surgery instead of simply adjusting 
> condition at redundant If (to 0/1) and let existing logic to eliminate 
> it?
>
> Best regards,
> Vladimir Ivanov
>
>>
>> 8220376: C2: Int >0 not recognized as !=0 for div by 0 check
>>
>>      Adding a simple subsumption test to IfNode::Ideal to enable a local
>>      short-circuit for (obviously) redundant if-nodes.
>>
>> Testing: hs-tier1-4, hs-precheckin-comp
>>
>>
>> Best regards,
>> Patric
>>



More information about the hotspot-compiler-dev mailing list