RFR: 8361699: C2: assert(can_reduce_phi(n->as_Phi())) failed: Sanity: previous reducible Phi is no longer reducible before SUT
Cesar Soares Lucas
cslucas at openjdk.org
Fri Sep 5 17:24:15 UTC 2025
On Fri, 5 Sep 2025 09:44:22 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Please, review this patch to fix issue that may occur when reducing allocation merge.
>>
>> As the assert message describe, the problem is a `Phi` considered reducible during one invocation of `adjust_scalar_replaceable_state` turned out to be later non-reducible. This situation can happen if a subsequent invocation of the same method causes all inputs to the phi to be NSR; therefore there is no point in reducing the Phi. It can also happen during the propagation of NSR state done by `find_scalar_replaceable_allocs`.
>>
>> The change in `revisit_reducible_phi_status` is just a clean-up.
>> The real fix is in `find_scalar_replaceable_allocs`.
>>
>> Tested on Linux x64/Aarch64 release/fastdebug with JTREG tier1-3.
>
> src/hotspot/share/opto/escape.cpp line 3078:
>
>> 3076: Node* phi = reducible_merges.at(i);
>> 3077:
>> 3078: if (!can_reduce_phi(phi->as_Phi())) {
>
> You say this is a pure cleanup? There are some slight differences in the code though, right?
> This method call checks `PhaseMacroExpand::can_eliminate_allocation`, and has a side effect with `ptn->set_scalar_replaceable(false)`.
>
> Just pointing it out, not a EA expert.
That shouldn't make a difference at this point in the analysis. I mentioned this is just a clean up because the verification that needs to be done at this point is essentially what is already performed in `can_reduce_phi` and this change doesn't have anything to do with the original issue.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27063#discussion_r2325657330
More information about the hotspot-compiler-dev
mailing list