On Wed, 25 Oct 2023 06:31:05 GMT, Emanuel Peter <epe...@openjdk.org> wrote:
>> I imagine it would be beneficial if we could merge stores to fields and >> stores from loads, which are common in object constructions. >> >> Thanks. > > @merykitty do you have examples for both? Maybe stores to fields already > works. Merging loads and stores may be out of scope. That sounds a little > much like SLP. We can still try to do that in a future RFE. We could even try > to use (masked) vector instructions. @eme64 I have tried your patch, it seems that there are some limitations: - The stores are not merged if the order is not right (e.g `a[2] = 2; a[1] = 1;`) - The stores are not merged if they are floating point constants. - The stores are not merged if they are consecutive fields in an object. E.g: class Point { int x; int y; } p.x = 1; p.y = 2; // Cannot merge into mov [p.x], 0x200000001 Regarding the final point, fields may be of different types with different sizes and there may be padding between them. This means that for load-store sequence merges, I think SLP cannot handle these cases. Thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16245#issuecomment-1779472249