RFR: 8355488: Add stress mode for C2 loop peeling

Tobias Hartmann thartmann at openjdk.org
Tue May 13 10:51:53 UTC 2025


On Fri, 9 May 2025 11:31:27 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:

> If anyone has another idea, I'd be happy to move it.

What about keeping track of the peeling in `LoopNode`? We already have an `_unswitch_count` there to limit loop unswitching.

src/hotspot/share/opto/compile.cpp line 666:

> 664:       _congraph(nullptr),
> 665:       NOT_PRODUCT(_igv_printer(nullptr) COMMA)
> 666:       NOT_PRODUCT(_peeling_rounds_of_node(comp_arena(), 8, 0, Pair<node_idx_t, uint>(0, 0)) COMMA)

`NOT_PRODUCT` means that it's also available in the optimized build but you only want/need it in debug.

src/hotspot/share/opto/compile.cpp line 5295:

> 5293: 
> 5294: uint& Compile::peeling_rounds_at_node(const Node* const head) {
> 5295:   for(int i = 0; i < _peeling_rounds_of_node.length(); ++i) {

Suggestion:

  for (int i = 0; i < _peeling_rounds_of_node.length(); ++i) {

src/hotspot/share/opto/compile.cpp line 5297:

> 5295:   for(int i = 0; i < _peeling_rounds_of_node.length(); ++i) {
> 5296:     auto& head_and_round_count = _peeling_rounds_of_node.at(i);
> 5297:     if(head_and_round_count.first == head->_idx) {

Suggestion:

    if (head_and_round_count.first == head->_idx) {

src/hotspot/share/opto/loopTransform.cpp line 506:

> 504: 
> 505:   // Check for vectorized loops, any peeling done was already applied.
> 506:   // Peeling is not legal here, we don't even stress peel!

Should this comment go to the `return 0;` and also describe why it's not legal?

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

PR Review: https://git.openjdk.org/jdk/pull/25140#pullrequestreview-2836183709
PR Review Comment: https://git.openjdk.org/jdk/pull/25140#discussion_r2086497092
PR Review Comment: https://git.openjdk.org/jdk/pull/25140#discussion_r2086491129
PR Review Comment: https://git.openjdk.org/jdk/pull/25140#discussion_r2086491377
PR Review Comment: https://git.openjdk.org/jdk/pull/25140#discussion_r2086492477


More information about the hotspot-compiler-dev mailing list