RFR: 8369258: C2: enable ReassociateInvariants for all loop types [v2]

Emanuel Peter epeter at openjdk.org
Wed Oct 15 15:23:22 UTC 2025


On Wed, 15 Oct 2025 14:44:29 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> Also, why are these not recognized as `CountedLoop`s, it seems we need to fix them, too?
>
> Without reassociate invariants, RCE elimination doesn't happen. With it, it does happen. So the loop becomes empty and that's why there's no `CountedLoop`. No problem here with `CountedLoop` recognition.
> The IR framework is not powerful enough to test this sort of things so I have to rely on some side effect that can be observed by the IR framework. In that case, reassociate invariants -> RCE optimization -> empty loop -> no `CountedLoop`.

Ah, nice explanation! Can you add that in a comment in the test code?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27666#discussion_r2432995236


More information about the hotspot-compiler-dev mailing list