RFR: 8318446: C2: optimize stores into primitive arrays by combining values into larger store [v17]
Emanuel Peter
epeter at openjdk.org
Thu Mar 7 17:07:59 UTC 2024
On Thu, 7 Mar 2024 16:03:20 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> That's not quite right, I think. For instance, in this method:
>>
>> private static int test(int[] array, int i) {
>> return array[i + 1];
>> }
>>
>> the final IR will have the `(AddP base (AddP ...) constant)` because `ConvI2LNode::Ideal` does more than checking for overflow. The actual transformation to that final shape must be delayed until after the CastII nodes are removed though. Why that's the case is puzzling actually because `CastIINode::Ideal()` has logic to push the AddI thru the `CastII` but it's disabled for range check `CastII` nodes. I noticed this while working on 8324517. My recollection was that `ConvI2LNode::Ideal` would push thru both the `CastII` and `ConvI2L` in one go so I wonder if it got broken at some point.
>
> Thanks for info, I'll look into this :)
Ah, I see what you are saying. The `AddI` can be pushed through the `ConvI2L`, but only because we know that the types are constrained. The types are constrained because of the `CastII` after the `RangeCheck`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16245#discussion_r1516525702
More information about the hotspot-compiler-dev
mailing list