RFR: 8366815: C2: Delay Mod/Div by constant transformation

Hannes Greule hgreule at openjdk.org
Tue Oct 21 17:40:46 UTC 2025


On Tue, 21 Oct 2025 16:36:36 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:

> Thank you for working on this, @SirYwell. This seems like a tricky problem. To be honest, the fix seems a bit hacky. Have you explored any alternatives to this method of delaying the optimizations?
> 
> I kicked off some testing in the meantime that I will report back upon completion.

Thanks for running tests. I tried delaying until post loop opts, but that prevents some vectorization and isn't really less hacky I guess. I didn't find any other good existing approach.  Calculating Value before Ideal would work, but I assume that it is rarely useful, with Div/Mod being an exception. I a dream world, I guess we would have e-graphs or something similar, which would allow calculating a more precise type from different alternatives.

If you can think of a better approach, please let me know.

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

PR Comment: https://git.openjdk.org/jdk/pull/27886#issuecomment-3428176218


More information about the hotspot-compiler-dev mailing list