RFR: 8350579: Remove Template Assertion Predicates belonging to a loop once it is folded away [v2]

Christian Hagedorn chagedorn at openjdk.org
Mon Mar 24 15:34:15 UTC 2025


On Mon, 24 Mar 2025 12:25:29 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/loopTransform.cpp line 1706:
>> 
>>> 1704:   // Compute the value of the loop induction variable at the end of the
>>> 1705:   // first iteration of the unrolled loop: init + new_stride_con - init_inc
>>> 1706:   int unrolled_stride_con = stride_con_before_unroll * 2;
>> 
>> Could we assert that `stride_con_before_unroll == main_loop_head->stride_con()`?
>
> If not, could we assert something similar?

I thought about somehow asserting here that as well. But the problem is that at this point, we already concatenated the original and the new loop together to represent one round of unrolling. So, we do not find the original loop exit check anymore from which we could have read the stride. That's why I explicitly take the cached `stride_con_before_unroll` and double it here.

We could have maybe cached the original loop exit node somehow to query it. But I don't think it adds much value since it's as good the original stride which was read from the loop exit node.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23823#discussion_r2010417724


More information about the hotspot-compiler-dev mailing list