RFR: 8366815: C2: Delay Mod/Div by constant transformation [v4]

Hannes Greule hgreule at openjdk.org
Fri Dec 19 07:34:01 UTC 2025


On Fri, 19 Dec 2025 06:59:07 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Hannes Greule has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>> 
>>  - Merge branch 'master' into delay-divmod-idealization
>>  - review
>>  - expand comments
>>  - delay integral Div/Mod Ideal() until IGVN
>>  - test
>
> We are getting some failures for this test, both on `x64` and `aarch64`:
> `compiler/igvn/IntegerDivValueTests.java`
> 
> 
> Compilation of Failed Method
> ----------------------------
> 1) Compilation of "public long compiler.igvn.IntegerDivValueTests.testLongRange(long)":
>> Phase "PrintIdeal":
> AFTER: print_ideal
>   0  Root  === 0 40  [[ 0 1 3 39 ]] inner 
>   1  Con  === 0  [[ ]]  #top
>   3  Start  === 3 0  [[ 3 5 6 7 8 9 ]]  #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:instptr:compiler/igvn/IntegerDivValueTests:NotNull+0,iid=bot, 6:long, 7:half}
>   5  Parm  === 3  [[ 40 ]] Control !jvms: IntegerDivValueTests::testLongRange @ bci:-1 (line 306)
>   6  Parm  === 3  [[ 40 ]] I_O !jvms: IntegerDivValueTests::testLongRange @ bci:-1 (line 306)
>   7  Parm  === 3  [[ 40 ]] Memory  Memory: @ptr:BotPTR+bot, idx=Bot; !jvms: IntegerDivValueTests::testLongRange @ bci:-1 (line 306)
>   8  Parm  === 3  [[ 40 ]] FramePtr !jvms: IntegerDivValueTests::testLongRange @ bci:-1 (line 306)
>   9  Parm  === 3  [[ 40 ]] ReturnAdr !jvms: IntegerDivValueTests::testLongRange @ bci:-1 (line 306)
>  39  ConL  === 0  [[ 40 ]]  #long:1
>  40  Return  === 5 6 7 8 9 returns 39  [[ 0 ]] 
> 
> 
> Failed IR Rules (1) of Methods (1)
> ----------------------------------
> 1) Method "public long compiler.igvn.IntegerDivValueTests.testLongRange(long)" - [Failed IR rules: 1]:
>    * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={"_#RSHIFT_L#_", "> 0", "_#ADD_L#_", "> 0", "_#AND_L#_", "> 0"}, failOn={"_#DIV#_"}, applyIfPlatform={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
>      > Phase "PrintIdeal":
>        - counts: Graph contains wrong number of nodes:
>          * Constraint 1: "(\\d+(\\s){2}(RShiftL.*)+(\\s){2}===.*)"
>            - Failed comparison: [found] 0 > 0 [given]
>            - No nodes matched!
>          * Constraint 2: "(\\d+(\\s){2}(AddL.*)+(\\s){2}===.*)"
>            - Failed comparison: [found] 0 > 0 [given]
>            - No nodes matched!
>          * Constraint 3: "(\\d+(\\s){2}(AndL.*)+(\\s){2}===.*)"
>            - Failed comparison: [found] 0 > 0 [given]
>            - No nodes matched!

Thanks @eme64, I guess that's what @ichttt mentioned. I'll merge master again and adjust the tests.

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

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


More information about the hotspot-compiler-dev mailing list