RFR: 8323220: Reassociate loop invariants involved in Cmps and Add/Subs [v3]
Emanuel Peter
epeter at openjdk.org
Tue Jan 23 15:18:29 UTC 2024
On Mon, 22 Jan 2024 21:50:11 GMT, Joshua Cao <duke at openjdk.org> wrote:
>> 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`.
@caojoshua I see. That is a sad limitation. You could now add a `@Run` statement, but that is overkill as well. I hope to improve the IR framework to make it a bit easier to pass better arguments soon. For now I think we could just leave it with constants, for simplicity.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17375#discussion_r1463435275
More information about the hotspot-compiler-dev
mailing list