Integrated: 8335220: C2: Missing check for Opaque4 node in EscapeAnalysis

Vladimir Kozlov kvn at openjdk.org
Thu Jun 27 16:09:14 UTC 2024


On Thu, 27 Jun 2024 05:33:11 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> While testing Leyden Early Release the problem was found in C2 EscapeAnalysis, in new code which handles allocations merge. `ConnectionGraph:: can_reduce_check_users()` have incomplete checks which missed case with `Opaque4` node between `If` and `Bool` nodes. As result we hit assert in `ConnectionGraph::specialize_cmp()` when trying to access inputs of `Cmp` node
> 
> Node* curr_cmp = curr_ctrl->in(0)->in(1)->in(1); // true/false -> if -> bool -> cmp
> con = curr_cmp->in(1)->is_Con() ? curr_cmp->in(1) : curr_cmp->in(2);
> 
> 
> This code was introduce for ReduceAllocationMerges optimization [JDK-8316991](https://bugs.openjdk.org/browse/JDK-8316991) in JDK-23. There was followup fix [JDK-8330853](https://bugs.openjdk.org/browse/JDK-8330853) to add more checks but it missed this case.
> 
> I added more strict check in `can_reduce_check_users()` to catch such cases. And added asserts in `specialize_cmp()` to verify expected nodes.
> 
> Tested tier1-3.hs-stress,hs-xcomp

This pull request has now been integrated.

Changeset: 9d986a01
Author:    Vladimir Kozlov <kvn at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/9d986a013d01a5bcc0942bcc490258038291c22c
Stats:     22 lines in 1 file changed: 13 ins; 3 del; 6 mod

8335220: C2: Missing check for Opaque4 node in EscapeAnalysis

Reviewed-by: chagedorn, cslucas

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

PR: https://git.openjdk.org/jdk/pull/19921


More information about the hotspot-compiler-dev mailing list