RFR: 8310524: C2: record parser-generated LoadN nodes for IGVN

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Tue Dec 5 10:33:39 UTC 2023


On Tue, 5 Dec 2023 09:05:35 GMT, Daniel Lundén <duke at openjdk.org> wrote:

> This changeset fixes an issue where LoadN nodes were not recorded during bytecode parsing for later revisit in IGVN, in some cases resulting in missed optimization opportunities (see, e.g., the included new regression test).
> 
> Changes:
> - Make sure to record newly added LoadN-nodes for IGVN in `GraphKit::make_load`.
> - Add a regression test.
> 
> ### Testing
> - tier1, tier2, tier3, tier4, tier5 (windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64)

src/hotspot/share/opto/graphKit.cpp line 1567:

> 1565:     record_for_igvn(ld);
> 1566:     if (ld->is_DecodeN()) {
> 1567:       // Also record the actual load (LoadN) in case ld is DecodeN

Maybe add an assertion here checking that `ld->in(1)` is indeed a LoadN node.

test/hotspot/jtreg/compiler/c2/irTests/igvn/TestLoadNIdeal.java line 48:

> 46: 
> 47:     @Test
> 48:     @IR(counts = {IRNode.LOAD_N, "1"})

Maybe add a precondition here testing that `UseCompressedOops` is enabled. Currently the test passes when running with  `-XX:-UseCompressedOops` because `UseCompressedOops` is not whitelisted by the IR framework and hence the IR check is disabled, but better to be explicit I think.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16967#discussion_r1415322398
PR Review Comment: https://git.openjdk.org/jdk/pull/16967#discussion_r1415320929


More information about the hotspot-compiler-dev mailing list