RFR: 8370077: C2: make Compile::_major_progress a boolean [v2]
Christian Hagedorn
chagedorn at openjdk.org
Thu Oct 23 06:59:03 UTC 2025
On Thu, 23 Oct 2025 05:33:46 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> It doesn't look safe to me to change the restore_major_progress() behavior in build_and_optimize(). It certainly looks possible to call set_major_progress() in the do_max_unroll case (lines 5146 - 5163) at least.
>
> Given @dean-long and @vnkozlov 's answers, I would suggest something like this:
>
> If major progress is set:
> Marks that the loop tree information (get_ctrl, idom, get_loop, etc) could be invalid, and we need to rebuild the loop tree.
> It also indicates that we have made progress, and so it is likely that we can make even more progress in a next round of loop optimizations.
> If major progress is not set:
> Loop tree information is valid.
> If major progress is not set at the end of a loop opts phase, then we can stop loop opts, because we do not expect any further progress if we did more loop ops phases.
>
> Suggestions for improvements?
Thanks for the suggestion above @eme64!
> Marks that the loop tree information (get_ctrl, idom, get_loop, etc) could be invalid, and we need to rebuild the loop tree.
Is it really invalid or just not as accurate as it could be but still correct? At least during a major loop optimizations like Loop Peeling etc. we try to keep things right and even recompute broken things when we are done, as for example after Loop Unswitching (which seems unnecessary if we assume things can really be invalid when major progress is set):
https://github.com/openjdk/jdk/blob/ffcb1585ed6c2a2bff28be6854d44a672aa31a0b/src/hotspot/share/opto/loopUnswitch.cpp#L314
> It also indicates that we have made progress, and so it is likely that we can make even more progress in a next round of loop optimizations.
I think "made progress" is somewhat hard to quantify. We could do plenty of progress in IGVN but not decide to do another loop opts round. But we could remove one useless bool in IGVN and decide to set major progress:
https://github.com/openjdk/jdk/blob/ffcb1585ed6c2a2bff28be6854d44a672aa31a0b/src/hotspot/share/opto/ifnode.cpp#L1449
Given that, I would rephrase it to something like:
"It also indicates that the graph was changed in a way that is promising to be able to apply more loop optimizations."
It seems that "major progress" is probably the wrong term since it not only indicates a major progress but also a "please apply more loop opts". Good example for that:
https://github.com/openjdk/jdk/blob/ffcb1585ed6c2a2bff28be6854d44a672aa31a0b/src/hotspot/share/opto/loopnode.cpp#L5291-L5298
What do you think?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27912#issuecomment-3435433072
More information about the hotspot-compiler-dev
mailing list