RFR: 8283094: Add Ideal transformation: x + (con - y) -> (x - y) + con [v5]
Zhiqiang Zang
duke at openjdk.java.net
Tue Mar 29 23:21:37 UTC 2022
On Tue, 29 Mar 2022 21:57:01 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> But in this case it seems OK to me to make the transformation, for example:
>>
>> for (int i = 0; i < 10000; i++) {
>> a[x + (MAX - i)] = b[x + (MAX - i)]; // a[(x - i) + MAX] = b[(x - i) + MAX]
>> }
>>
>> Is there something I overlooked?
>
> In loopopts (and superword) we are loking for `(+-phi +- const)` pattern for loop variable.
> With your transformation we get `((+-phi +- x) + const)` which may prevent some optimizations.
Makes sense. Thanks for the explanation. I included the check in a new commit.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7795
More information about the hotspot-compiler-dev
mailing list