RFR: 8347499: C2: Make `PhaseIdealLoop` eliminate more redundant safepoints in loops [v3]
Qizheng Xing
qxing at openjdk.org
Fri Jun 20 01:37:43 UTC 2025
On Thu, 22 May 2025 07:53:39 GMT, Qizheng Xing <qxing at openjdk.org> wrote:
>> In `PhaseIdealLoop`, `IdealLoopTree::check_safepts` method checks if any call that is guaranteed to have a safepoint dominates the tail of the loop. In the previous implementation, `check_safepts` would stop if it found a local non-call safepoint. At this time, if there was a call before the safepoint in the dom-path, this safepoint would not be eliminated.
>>
>> <img width="353" alt="loop-safepoint" src="https://github.com/user-attachments/assets/c220e103-aaba-4e3f-98ac-1ddb6465c309" />
>>
>> This patch changes the behavior of `check_safepts` to not stop when it finds a non-local safepoint. This makes simple loops with one method call ~3.8% faster (on aarch64).
>>
>>
>> Benchmark Mode Cnt Score Error Units
>> LoopSafepoint.loopVar avgt 15 208296.259 ± 1350.409 ns/op # baseline
>> LoopSafepoint.loopVar avgt 15 200692.874 ± 616.770 ns/op # this patch
>>
>>
>> Testing: tier1-2 on x86_64 and aarch64.
>
> Qizheng Xing has updated the pull request incrementally with one additional commit since the last revision:
>
> Improve documentation comments
Hi all,
This patch has now passed all GHA tests and is ready for further reviews.
If there are any other suggestions for this PR, please let me know.
Thanks!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23057#issuecomment-2989561073
More information about the hotspot-compiler-dev
mailing list