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

Benoît Maillard bmaillard at openjdk.org
Tue Dec 16 08:20:01 UTC 2025


On Mon, 15 Dec 2025 13:53:00 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> 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`.
>
> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update test/hotspot/jtreg/testlibrary_tests/ir_framework/tests/TestIRFindFromAbove.java
>   
>   Co-authored-by: Roberto Castañeda Lozano <robcasloz at users.noreply.github.com>

Looks good to me, thanks for fixing :)

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

Marked as reviewed by bmaillard (Committer).

PR Review: https://git.openjdk.org/jdk/pull/28762#pullrequestreview-3581865492


More information about the hotspot-compiler-dev mailing list