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

Quan Anh Mai qamai at openjdk.org
Fri Oct 11 18:56:39 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:

  refinement

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

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

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

  Stats: 44 lines in 2 files changed: 34 ins; 3 del; 7 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