RFR: 8343067: C2: revisit constant-offset AddP chains after successful input idealizations

Vladimir Kozlov kvn at openjdk.org
Tue Nov 5 18:05:29 UTC 2024


On Tue, 5 Nov 2024 10:02:16 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

> This changeset re-adds a constant-offset AddP node (`u`) to C2's IGVN worklist when its address is given by another AddP node (`use`) whose offset has changed. This makes it possible for `AddPNode::Ideal` to flatten the address computation in cases where the offset of the latter (`use->in(AddPNode::Offset)`) is found to be constant during IGVN:
> 
> ![idealization](https://github.com/user-attachments/assets/6b632642-c037-457f-bd19-6b30f24e6ac6)
> 
> The end result is the generation of fewer explicit address computation instructions.
> 
> #### Testing
> 
> ##### Functionality
> 
> - tier1-5 (linux-x64, windows-x64, macosx-x64, linux-aarch64, macosx-aarch64; release and debug mode).
> 
> ##### Performance
> 
> - Tested performance on a set of standard benchmark suites (DaCapo, SPECjbb2015, SPECjvm2008). No significant change was observed.

src/hotspot/share/opto/phaseX.cpp line 1647:

> 1645:       if (u->is_Mem()) {
> 1646:         worklist.push(u);
> 1647:       } else if (n == use->in(AddPNode::Offset) &&

`n == use->in(AddPNode::Offset)` result can be saved outside loop in local var.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21898#discussion_r1829796865


More information about the hotspot-compiler-dev mailing list