RFR: 8318446: C2: optimize stores into primitive arrays by combining values into larger store [v17]
Emanuel Peter
epeter at openjdk.org
Thu Mar 7 07:47:58 UTC 2024
On Wed, 6 Mar 2024 08:58:01 GMT, Roland Westrelin <roland at openjdk.org> wrote:
>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> a little bit of casting for debug printing code
>
> src/hotspot/share/opto/memnode.cpp line 2971:
>
>> 2969: // The goal is to check if two such ArrayPointers are adjacent for a load or store.
>> 2970: //
>> 2971: // Note: we accumulate all constant offsets into constant_offset, even the int constant behind
>
> Is this really needed? For the patterns of interest, aren't the constant pushed down the chain of `AddP` nodes so the address is `(AddP base (AddP ...) constant)`?
No, they are not pushed down.
Consider the access on an int array:
`a[invar + 1]` -> `adr = base + ARRAY_INT_BASE_OFFSET + 4 * ConvI2L(invar + 1)`
We cannot just push the constant `1` out of the `ConvI2L`, after all `invar + 1` could overflow in the int domain ;)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16245#discussion_r1515686654
More information about the hotspot-compiler-dev
mailing list