RFR: 8335220: C2: Missing check for Opaque4 node in EscapeAnalysis [v2]
Vladimir Kozlov
kvn at openjdk.org
Thu Jun 27 14:58:37 UTC 2024
> 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
Vladimir Kozlov has updated the pull request incrementally with one additional commit since the last revision:
Add comment about Opaque4
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/19921/files
- new: https://git.openjdk.org/jdk/pull/19921/files/a0687aee..c06f6ce0
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=19921&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=19921&range=00-01
Stats: 3 lines in 1 file changed: 3 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/19921.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/19921/head:pull/19921
PR: https://git.openjdk.org/jdk/pull/19921
More information about the hotspot-compiler-dev
mailing list