RFR: 8335708: C2: Compile::verify_graph_edges must start at root and safepoints, just like CCP traversal [v2]
Emanuel Peter
epeter at openjdk.org
Thu Mar 20 12:38:16 UTC 2025
On Tue, 18 Mar 2025 13:57:33 GMT, Marc Chevalier <duke at openjdk.org> wrote:
>> In CCP, we transform the nodes going up (toward inputs) starting from root and safepoints because infinite loops can be reachable from the root, but not co-reachable from the root, that is one can follow def-use from root to the loop, but not the use-def from root to loop. For more details, see:
>> https://github.com/openjdk/jdk/blob/4cf63160ad575d49dbe70f128cd36aba22b8f2ff/src/hotspot/share/opto/phaseX.cpp#L2063-L2070
>>
>> Since we are specifically marking nodes as useful if they are above a safepoint, the check that no dead nodes must be there anymore must also consider nodes above a safepoint as alive: the same criterion must apply. We should nevertheless not start from a safepoint killed by CCP.
>>
>> About the test, I use this trick found in `TestInfiniteLoopCCP` because I indeed need a really infinite loop, but I want a terminating test. The crash is not deterministic, as it needs StressIGVN, so I did a bit of stats. Using a little helper script, on 100 runs, 69 runs fail as in the JBS ticket and 31 are successful (so 0 fail in another way). After the fix, I find 100 successes.
>>
>> And thanks to @eme64 who extracted such a concise reproducer.
>
> Marc Chevalier has updated the pull request incrementally with one additional commit since the last revision:
>
> various fixes
@marc-chevalier Looks good to me, except for missing punctuation ;)
src/hotspot/share/opto/compile.hpp line 1233:
> 1231: // Graph verification code
> 1232: // Walk the node list, verifying that there is a one-to-one correspondence
> 1233: // between Use-Def edges and Def-Use edges The option no_dead_code enables
Suggestion:
// between Use-Def edges and Def-Use edges. The option no_dead_code enables
-------------
Marked as reviewed by epeter (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/23977#pullrequestreview-2702539899
PR Review Comment: https://git.openjdk.org/jdk/pull/23977#discussion_r2005539542
More information about the hotspot-compiler-dev
mailing list