RFR: 8314580: PhaseIdealLoop::transform_long_range_checks fails with assert "was tested before"

Roland Westrelin roland at openjdk.org
Mon Sep 4 15:20:54 UTC 2023


On Wed, 30 Aug 2023 14:48:07 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> For long counted loops, `PhaseIdealLoop::create_loop_nest()` first
>> goes over the loop body to collect range checks, then transforms the
>> long counted loop into a loop nest and then goes over the list of
>> range checks it collected to transfrom them. For that last step,
>> `PhaseIdealLoop::transform_long_range_checks()` needs to extract the
>> parameters of the range check from the range check expression. It
>> should still recognize the range check expression even though the loop
>> was transformed in the meantime. That's what fails here. The reason is
>> that the range check expression uses the long loop increment as input
>> which, in the creation of the loop nest, is transformed to `outer
>> phi + inner incr`. That breaks pattern matching of the range check
>> expression. I propose removing the transformation:
>> 
>> 
>> incr=>(outer_phi+inner_incr)
>> 
>> 
>> entireley. After looking at this code again, I don't think it's
>> needed. The transformation:
>> 
>> 
>> phi=>(outer_phi+inner_phi)
>> 
>> 
>> should be all that's needed to correctly transform the loop.
>
> Looks reasonable to me.

@chhagedorn @vnkozlov thanks for the reviews.

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

PR Comment: https://git.openjdk.org/jdk/pull/15411#issuecomment-1705436175


More information about the hotspot-compiler-dev mailing list