RFR: 8373355: C2: CompileCommand PrintIdealPhase should also print nodes that are not "reachable from below"

Emanuel Peter epeter at openjdk.org
Mon Dec 15 12:43:07 UTC 2025


PrintIdealPhase seems to only traverse the graph "from below". So if there are any nodes that are not reachable "from below" but only reachable "from above", then they do not show up in the printing.
That is problematic: out TestFramework relies on that output, especially if you have some IR rule with failOn or count = 0 . The node would be in the graph, but the test tells you there is none.

Before the fix, we used to see this:
The LoadI and StoreI do NOT show up during ITER_GVN1.
This is because at that point, the infinite loop has no exit. So the loop is not connected down to Root.
But once we do a first loop opts round, we see the LoadI and StoreI in PHASEIDEALLOOP1.
This is because we insert a NeverBranch, which serves as an artificial exit, that connects the loop down to Root.

Fix: travese both up `+` and down `-`.

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

Note: I had to update some tests from https://github.com/openjdk/jdk/pull/22786.
This is because during IGVN the constant nodes that lose all outputs are not removed. So now they show up in the IR graph, and the IR rules failed. I adjusted the IR rules to work with the operations `ModF/ModD` rather than constants `ConF/ConD`.

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

Commit messages:
 - fixed up other test
 - wip
 - wip fixing ModFNodeTests.java
 - JDKJDK-8373355

Changes: https://git.openjdk.org/jdk/pull/28762/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28762&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8373355
  Stats: 220 lines in 5 files changed: 165 ins; 10 del; 45 mod
  Patch: https://git.openjdk.org/jdk/pull/28762.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28762/head:pull/28762

PR: https://git.openjdk.org/jdk/pull/28762


More information about the hotspot-compiler-dev mailing list