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

Roland Westrelin roland at openjdk.org
Fri Apr 19 13:51:04 UTC 2024


On Thu, 18 Apr 2024 09:52:32 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/c2/irTests/TestScopedValue.java line 24:
>> 
>>> 22:  */
>>> 23: 
>>> 24: package compiler.c2.irTests;
>> 
>> Christian and I have discussed this a while back: it would be nicer to put tests where they belong thematically. For example now it would be difficult to find all ScopedValue compiler tests, some are in the `irTests` directory, some elsewhere. Hence, I suggest you put them all under `compiler/scoped_value` or similar.
>
> Where are the already existing ScopedValue tests?

There are no ScopedValue compiler tests that I know of. Moving the ScopedValue IR tests out of irTests look good to me. Let me do that.

>> test/hotspot/jtreg/compiler/c2/irTests/TestScopedValue.java line 137:
>> 
>>> 135:         MyDouble sv1 = sv.get();
>>> 136:         notInlined();
>>> 137:         MyDouble sv2 = sv.get(); // Doesn't optimize out (load of sv cannot common)
>> 
>> Is this a necessary constraint, or a limitation of the optimization? Please add a corresponding comment. That would be helpful if this test all of the sudden failed the IR rule, and one has to debug.
>
> If this was in a loop, the two `get` would be hoisted, and commoned, right?

They wouldn't. `sv` is a field and c2 can't common the 2 field loads.

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

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


More information about the hotspot-compiler-dev mailing list