RFR: 8347555: [REDO] C2: implement optimization for series of Add of unique value [v18]

Emanuel Peter epeter at openjdk.org
Wed Sep 17 15:22:40 UTC 2025


On Wed, 17 Sep 2025 15:08:43 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Kangcheng Xu has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 67 commits:
>> 
>>  - Merge branch 'openjdk:master' into arithmetic-canonicalization
>>  - Merge remote-tracking branch 'origin/master' into arithmetic-canonicalization
>>  - Allow swapping LHS/RHS in case not matched
>>  - Merge branch 'refs/heads/master' into arithmetic-canonicalization
>>  - improve comment readability and struct helper functions
>>  - remove asserts, add more documentation
>>  - fix typo: lhs->rhs
>>  - update comments
>>  - use java_add to avoid cpp overflow UB
>>  - add assertion for MulLNode too
>>  - ... and 57 more: https://git.openjdk.org/jdk/compare/173dedfb...7bb7e645
>
> src/hotspot/share/opto/addnode.cpp line 544:
> 
>> 542: //     - (2) AddNode(LShiftNode(a, CON), a)
>> 543: //     - (3) AddNode(a, LShiftNode(a, CON))
>> 544: //     - (4) AddNode(a, a)
> 
> You could drop the `Node` part from the cases here, to make it a bit more concise.

Alternatively, you could do it with the `<<` operator like you did in `find_serial_addition_patterns`. I think that would be more consistent.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23506#discussion_r2355861249


More information about the hotspot-compiler-dev mailing list