RFR: 8320649: C2: Optimize scoped values [v9]

Roland Westrelin roland at openjdk.org
Wed Mar 6 13:51:16 UTC 2024


On Mon, 26 Feb 2024 16:09:09 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   32 bit build fix
>
> src/hotspot/share/opto/loopTransform.cpp line 3790:
> 
>> 3788:         phase->do_peeling(this, old_new);
>> 3789:         return false;
>> 3790:       }
> 
> Just because I'm curious: why do the other places not already peel these loops? I.e. why do we need this here?

Peeling looks for a loop invariant condition with one branch that exits the loop because then peeling makes the test in the loop body redundant with the one in the peeled iteration. Here, if there's a `ScopedValue.get()` on a loop invariant `ScopedValue` object, peeling one iteration will make `ScopedValue.get()` in the loop body redundant with the one in the peeled iteration. So it's not quite the same, at least, because for `ScopedValue.get()` the optimization applies whether `ScopedValue.get()` causes an exit of the loop or not.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16966#discussion_r1514512542


More information about the hotspot-compiler-dev mailing list