RFR: 8366815: C2: Delay Mod/Div by constant transformation
    Manuel Hässig 
    mhaessig at openjdk.org
       
    Tue Oct 21 16:39:17 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.
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.
src/hotspot/share/opto/divnode.cpp line 545:
> 543: 
> 544:   // Keep this node as-is for now; we want Value() and
> 545:   // other optimizations checking for this node type to work
Suggestion:
  // Keep this node as-is initially; we want Value() and
  // other optimizations checking for this node type to work.
This is a small nit: I find it confusing to talk about "for now" in a method that is called at almost every stage of the compilation. Perhaps "initially" conveys the intention of first letting other optimizations do their magic first a bit better.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27886#pullrequestreview-3361503632
PR Review Comment: https://git.openjdk.org/jdk/pull/27886#discussion_r2448851036
    
    
More information about the hotspot-compiler-dev
mailing list