RFR: 8341697: C2: Register allocation inefficiency in tight loop [v4]
Quan Anh Mai
qamai at openjdk.org
Sat Oct 12 10:30:51 UTC 2024
> Hi,
>
> This patch improves the spill placement in the presence of loops. Currently, when trying to spill a live range, we will create a `Phi` at the loop head, this `Phi` will then be spilt inside the loop body, and as the `Phi` is `UP` (lives in register) at the loop head, we need to emit an additional reload at the loop back-edge block. This introduces loop-carried dependencies, greatly reduces loop throughput. My proposal is that if a node is not reassigned inside a loop, and will be spilt there, we spill it eagerly at the loop entry instead. This can lead to more reload inside the loop, but as the loop-carried dependencies are eliminated, a load is negligible.
>
> Please take a look and leave your reviews, thanks a lot.
Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
add LoopAwaredSpilling flag, refine implementation
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/21472/files
- new: https://git.openjdk.org/jdk/pull/21472/files/b6e78eb8..5f572bbb
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=21472&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=21472&range=02-03
Stats: 167 lines in 3 files changed: 97 ins; 6 del; 64 mod
Patch: https://git.openjdk.org/jdk/pull/21472.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/21472/head:pull/21472
PR: https://git.openjdk.org/jdk/pull/21472
More information about the hotspot-compiler-dev
mailing list