RFR: 8277850: C2: optimize mask checks in counted loops [v2]
Roland Westrelin
roland at openjdk.java.net
Tue Dec 7 11:06:53 UTC 2021
> This is another fix that addresses a performance issue with panama and that was brought up by Maurizio. The pattern to optimize is:
> if ((base + (offset << 2)) & 3) != 0) {
> }
>
> where base is loop independent but offset depends on a loop variable. This can be transformed to:
>
> if ((base & 3) != 0) {
>
> That check becomes loop independent and be optimized by loop predication (or I suppose loop unswitching but that wasn't the case of the micro benchmark I worked on).
>
> This change also optimizes the pattern:
>
> (offset << 2) & 3
>
> to return 0.
Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
- reviews
- Merge branch 'master' into JDK-8277850
- whitespace
- fix
- fix
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/6697/files
- new: https://git.openjdk.java.net/jdk/pull/6697/files/0d0a7c9c..f7165648
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6697&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6697&range=00-01
Stats: 11458 lines in 536 files changed: 7406 ins; 1974 del; 2078 mod
Patch: https://git.openjdk.java.net/jdk/pull/6697.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/6697/head:pull/6697
PR: https://git.openjdk.java.net/jdk/pull/6697
More information about the hotspot-compiler-dev
mailing list