RFR: 8364766: C2: Improve Value() of DivI and DivL for non-constant inputs [v10]

Emanuel Peter epeter at openjdk.org
Thu Nov 13 12:12:51 UTC 2025


On Thu, 13 Nov 2025 12:05:31 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Tobias Hotz has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Move Test to compiler.igvn
>
> test/hotspot/jtreg/compiler/igvn/IntegerDivValueTests.java line 66:
> 
>> 64:         // All constants available during parsing
>> 65:         return getIntConstant(Integer.MIN_VALUE) / getIntConstant(-1);
>> 66:     }
> 
> Why not add an IR rule that the div is still present after parsing? It seems you have already had the possible issue that javac optimized the div away, right? So this would ensure the optimization really does happen in C2, and that you are checking for the right kinds of nodes.

Consider doing the same in other places in this file ;)

> test/hotspot/jtreg/compiler/igvn/IntegerDivValueTests.java line 286:
> 
>> 284:     // transform_long_divide splits up the division into multiple other nodes, such as MulHiLNode, which does not have a good Value() implemantion.
>> 285:     // When JDK-8366815 is fixed, these rules should be reenabled
>> 286:     // Alternatively, a better MulHiLNode::Value() implemantion should also lead to constant folding
> 
> Could you have some temporary IR rule that now passes, but fails once `JDK-8366815` is fixed? Otherwise, I'm afraid we will miss these comments here, and they will never be cleaned up.

Same elsewhere in this file.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26143#discussion_r2523210177
PR Review Comment: https://git.openjdk.org/jdk/pull/26143#discussion_r2523214882


More information about the hotspot-compiler-dev mailing list