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

Emanuel Peter epeter at openjdk.org
Thu Oct 23 11:42:06 UTC 2025


On Sun, 19 Oct 2025 15:46:06 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

> The test cases show examples of code where `Value()` previously wasn't run because idealization took place before, resulting in less precise type analysis.
> 
> Please let me know what you think.

Thanks very much for the explanation and the nice graph 😊 

That helps a lot. It also means that even for cases like @mhaessig showed above:
https://github.com/openjdk/jdk/pull/27886#issuecomment-3432972151

We could still constant fold the comparison.... as long as the comparison is "relaxed enough". It might be worth having a handfull of examples like that: some that still constant fold, and some that don't because the comparison is too "sharp", and the "rounding error" too large. What do you think?

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

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


More information about the hotspot-compiler-dev mailing list