[lworld] Integrated: 8265973: [lworld] C2 compilation fails due to infinite loop in PhaseIterGVN::optimize

Tobias Hartmann thartmann at openjdk.java.net
Thu May 6 09:01:28 UTC 2021


On Fri, 30 Apr 2021 12:26:26 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

> This is another instance of [JDK-8264586](https://bugs.openjdk.java.net/browse/JDK-8264586). The fix was not sufficient. The root cause is a subgraph that becomes unreachable from the bottom (but remains reachable from the top) after CCP removes a redundant null check. 
> 
> **Gory details:**
> CCP has two phases. First, `PhaseCCP::analyze` visits all nodes and updates their types in `_types.map`. Then, `PhaseCCP::do_transform` only visits the nodes that are reachable from the bottom, updates their `bottom_type` and adds them to the IGVN worklist. During the second step, parts of the graph might be cut off (for example, due to a null-check that is found to be redundant) and the nodes of that subgraph are not visited. I.e., the following code is not executed:
> https://github.com/openjdk/valhalla/blob/28a4ec0249fd86fe17f2b816c6f5f8eed31abfeb/src/hotspot/share/opto/phaseX.cpp#L1988-L1992
> 
> As a result, `LoadNodes` in the dead subgraph end up with types that are inconsistent with their bottom types. Since they are still reachable from the top, they will be processed by IGVN and then re-enqueued for IGVN indefinitely by this code:
> https://github.com/openjdk/valhalla/blob/28a4ec0249fd86fe17f2b816c6f5f8eed31abfeb/src/hotspot/share/opto/memnode.cpp#L352-L358
> 
> The fix is to aggressively remove useless nodes after CCP. I'll consider upstreaming the fix after some bake time in Valhalla.
> 
> Thanks,
> Tobias

This pull request has now been integrated.

Changeset: f43fafc7
Author:    Tobias Hartmann <thartmann at openjdk.org>
URL:       https://git.openjdk.java.net/valhalla/commit/f43fafc7d81f3d34f6e971765dbadae41ae5c393
Stats:     106 lines in 7 files changed: 80 ins; 11 del; 15 mod

8265973: [lworld] C2 compilation fails due to infinite loop in PhaseIterGVN::optimize

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

PR: https://git.openjdk.java.net/valhalla/pull/397


More information about the valhalla-dev mailing list