RFR: 8335220: C2: Missing check for Opaque4 node in EscapeAnalysis [v2]
Cesar Soares Lucas
cslucas at openjdk.org
Thu Jun 27 15:56:12 UTC 2024
On Thu, 27 Jun 2024 14:58:37 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
>
> Vladimir Kozlov has updated the pull request incrementally with one additional commit since the last revision:
>
> Add comment about Opaque4
LGTM. Thank you for fixing.
-------------
Marked as reviewed by cslucas (Author).
PR Review: https://git.openjdk.org/jdk/pull/19921#pullrequestreview-2145831905
More information about the hotspot-compiler-dev
mailing list