[12] RFR(M): 8210215: C2 should optimize trichotomy calculations

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Oct 3 15:15:39 UTC 2018


On 10/3/18 12:41 AM, Tobias Hartmann wrote:
> Hi Vladimir,
> 
> On 02.10.2018 19:35, Vladimir Kozlov wrote:
>> Okay. My point is that such optimization should be handled separately and not part of
>> optimize_trichotomy(). You can have multi-inputs Region (not just 2 or 3) with the same If nodes case.
> 
> Yes but in the case of multi-input regions it gets more complicated because we need to search all
> inputs for an if that feeds both projections into the region and then need to check the
> corresponding phi user inputs for equality. We might also want to support multiple phi users which
> adds an additional level of complexity. In optimize_trichotomy() we get these checks for free for
> the 2 and 3 inputs case.
> 
> This change is intended to optimize a quite specific and common code shape. It's already more
> complex than initially intended, so I don't think we should add yet another optimization with this.

Okay, I agree with you.

> 
> I can file a separate enhancement and remove the "useless if" part once that optimization is in. Or
> I can remove it which will prevent optimization of some of the shapes.
> 
> Here's the latest webrev that includes John's suggestions:
> http://cr.openjdk.java.net/~thartmann/8210215/webrev.03/

This looks good.

Thanks,
Vladimir

> 
> And here's a version without the "useless if" part (since we are not modifying 'this' anymore, we
> don't need to set 'modified'):
> http://cr.openjdk.java.net/~thartmann/8210215/webrev.03_2/
> 
> What do you think?
> 
> Thanks,
> Tobias
> 


More information about the hotspot-compiler-dev mailing list