RFR: 8323220: Reassociate loop invariants involved in Cmps and Add/Subs [v3]

Joshua Cao duke at openjdk.org
Mon Jan 22 21:52:28 UTC 2024


On Mon, 22 Jan 2024 09:11:13 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Joshua Cao has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Assert for n2. Variables for n1/n2 opcode. More concise comments.
>>   Overflow/random tests
>
> test/hotspot/jtreg/compiler/loopopts/InvariantCodeMotionReassociateCmp.java line 163:
> 
>> 161:             }
>> 162:         }
>> 163:     }
> 
> Why could you not have random arguments here?

[notEqualsInvariantSubVariantLong.txt](https://github.com/openjdk/jdk/files/14015703/notEqualsInvariantSubVariantLong.txt)

Attaching the IdealGraphVisualizer file (renamed to `.txt` cause GitHub wants that).

When we use `Argument.NUMBER_42`, we can avoid generating traps. When `i == 0` we enter the if statement, otherwise we exit.

If we use random numbers, we most likely never enter the if statement so we can generate a trap there. In this case, the trap block as an extra `SubL` for `inv1 - i`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17375#discussion_r1462462105


More information about the hotspot-compiler-dev mailing list