[lworld] RFR: 8265973: [lworld] C2 compilation fails due to infinite loop in PhaseIterGVN::optimize
thartmann at openjdk.java.net
Mon May 3 14:54:38 UTC 2021
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.
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:
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:
The fix is to aggressively remove useless nodes after CCP. I'll consider upstreaming the fix after some bake time in Valhalla.
- Some fixes
- 8265973: [lworld] C2 compilation fails due to infinite loop in PhaseIterGVN::optimize
Stats: 82 lines in 7 files changed: 64 ins; 8 del; 10 mod
Fetch: git fetch https://git.openjdk.java.net/valhalla pull/397/head:pull/397
More information about the valhalla-dev