RFR: 8341697: C2: Register allocation inefficiency in tight loop [v3]

Quan Anh Mai qamai at openjdk.org
Fri Oct 11 19:14:28 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:

  refactor

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21472/files
  - new: https://git.openjdk.org/jdk/pull/21472/files/85a2c266..b6e78eb8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=21472&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=21472&range=01-02

  Stats: 30 lines in 1 file changed: 16 ins; 4 del; 10 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