RFR: 8020282: Generated code quality: redundant LEAs in the chained dereferences [v2]

Manuel Hässig mhaessig at openjdk.org
Mon Jun 16 13:39:35 UTC 2025


On Fri, 13 Jun 2025 12:12:08 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> That makes a lot of things much clearer. I like it! Thank you for the suggestion! Incorporated in 3d6f897
>
> Thanks, now that you have defined `lea_address` and `decode_address`, the logic that distinguishes between the spill/no spill cases can be further simplified by letting these pointers step over the spill node in the case of spilling:
> 
> 
>   if (is_spill) {
>     decode_address = decode_address->in(1);
>     lea_address = lea_address->in(1);
>   }
> 
> 
> Then you can use them directly later on instead of conditionally using e.g. `decode_address` or `decode_address->in(1)` depending on the value of `is_spill`. Here a sketch of my suggested refactoring (not tested): https://github.com/openjdk/jdk/commit/2b75e85dbeedd380ab3ea02c64816c931b3dfe33. Feel free to apply it (or parts of it) if you agree that it makes the code more readable.

That is quite an improvement! I applied it. Thank you for your detailed suggestion!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25471#discussion_r2150032824


More information about the hotspot-compiler-dev mailing list