[lworld] RFR: 8368782: [lworld] C2: fatal error: no reachable node should have no use

Christian Hagedorn chagedorn at openjdk.org
Mon Oct 6 12:18:47 UTC 2025


`test9()` in `TestLWorld.java` is crashing intermittently when running with `StressLoopPeeling`.

The problem can be traced back to a node that is not re-added to the IGVN worklist in `PhiNode::Ideal()`:
<img width="282" height="198" alt="graph" src="https://github.com/user-attachments/assets/e8597cf1-d49f-4c8d-b248-184b25f30fba" />

We are processing `3786 Phi` and update its input `3748 Phi` to another node. As a result, `3748 Phi` loses it's last output and is now dead. It should be re-added to the IGVN worklist to be cleaned up. But that does not happen because we use `set_req()` on `3786 Phi` instead of `set_req_X()` when replacing the input `3748 Phi`. As a result, the dead node stays in the graph and eventually triggers the "no dead use" assert.

The fix is straight forward to use `set_req_X()` which ensures that a now dead input node is pushed to the IGVN worklist again and cleaned up later.

The affected code is also wrong in mainline but has never triggered there. Therefore, I suggest to wait and not eagerly upstream it to mainline for now.

Thanks,
Christian

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

Commit messages:
 - 8368782: [lworld] C2: fatal error: no reachable node should have no use

Changes: https://git.openjdk.org/valhalla/pull/1662/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1662&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8368782
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/valhalla/pull/1662.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1662/head:pull/1662

PR: https://git.openjdk.org/valhalla/pull/1662


More information about the valhalla-dev mailing list