RFR: 8283094: Add Ideal transformation: x + (con - y) -> (x - y) + con [v6]
Zhiqiang Zang
duke at openjdk.java.net
Tue Mar 29 23:21:37 UTC 2022
> Hello,
>
> `x + (con - y) -> (x - y) + con` is a widely seen pattern; however it is missing in current implementation, which prevents some obvious constant folding from happening, such as `x + (1 - y) + 2` will be not optimized at all, rather than into `x - y + 3`.
>
> This pull request adds this transformation.
Zhiqiang Zang has updated the pull request incrementally with one additional commit since the last revision:
do not transform for loop induction variable.
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/7795/files
- new: https://git.openjdk.java.net/jdk/pull/7795/files/e9951dda..00b79922
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7795&range=05
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7795&range=04-05
Stats: 4 lines in 1 file changed: 2 ins; 0 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/7795.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/7795/head:pull/7795
PR: https://git.openjdk.java.net/jdk/pull/7795
More information about the hotspot-compiler-dev
mailing list