RFR: JDK-8153837: AArch64: Handle special cases for MaxINode & MinINode [v2]

Xiaohong Gong xgong at openjdk.org
Wed Dec 21 01:55:48 UTC 2022


On Tue, 20 Dec 2022 11:23:33 GMT, Dmitry Chuyko <dchuyko at openjdk.org> wrote:

>> So how about doing the constant swap at the start of the `ideal`, before all other optimizations (i.e. `max(max[...])` and `max(add[...])`). I think it can also benefit other optimizations. E.g. for this optimization: 
>> 
>> MaxI1(MaxI2(a, b), c)  ==>  MaxI1(a, MaxI2(b, c))
>> 
>> If "`b`" is a constant in `MaxI2(a, b)`, and `c` is a constant in `MaxI1(...)`, After the above optimization, `MaxI2(b, c)` can be constant folding into a constant, which is good. But without the constant swap, (i.e. `b` and `c` may not be a constant), the constant folding will be missed for some cases.
>
> Other optimizations up in the tree look into already finished nodes. As I said above we can't always order all of three Min/Max, Add, Con so they will have to duplicate search patterns. I would prefer to order Con to the right and maybe Min/Max to the left as well, but that feels like a separate improvement, after that reverted rules can be easily excluded from generated code.

OK, make sense to me. We can have a separate PR for this improvement. Thanks!

-------------

PR: https://git.openjdk.org/jdk/pull/11570


More information about the hotspot-compiler-dev mailing list