RFR: 8323220: Reassociate loop invariants involved in Cmps and Add/Subs [v2]

Joshua Cao duke at openjdk.org
Wed Jan 17 19:42:23 UTC 2024


On Tue, 16 Jan 2024 17:40:08 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Joshua Cao has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Formatting and comments
>
> src/hotspot/share/opto/loopTransform.cpp line 345:
> 
>> 343:   bool neg_inv1 = (n1->is_Sub() && !n1->is_Cmp() && inv1_idx == 2) ||
>> 344:                   (n1->is_Cmp() && inv2_idx == 1 && n2->is_Sub());
>> 345:   if (n1->is_Sub() && !n1->is_Cmp() && inv1_idx == 1) {
> 
> Would you mind adding some comments for this logic?

I added a little comment block. Not sure how useful it is. I agree the code is hard to follow. Before all the changes for `Cmp`, I was able to make sense of it by following the comments at the top of the function.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17375#discussion_r1456381211


More information about the hotspot-compiler-dev mailing list