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

Kangcheng Xu kxu at openjdk.org
Tue Oct 7 15:08:49 UTC 2025


On Tue, 7 Oct 2025 12:19:44 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> Kangcheng Xu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use CONST64() macro
>
> src/hotspot/share/opto/addnode.cpp line 570:
> 
>> 568: 
>> 569:     // Pattern (4), which is equivalent to a simple addition pattern
>> 570:     return find_simple_addition_pattern(n, bt);
> 
> Isn't that one redundant with the call to `find_simple_addition_pattern()` in `AddNode::Multiplication::find_collapsible_addition_patterns()`?

Yes it is, but `find_power_of_two_addition_pattern()` is also called in `AddNode::Ideal_collapse_variable_times_con()` which requires the simple `n + n` pattern to be detected to avoid repeating idealizing the same nodes without progress.

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

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


More information about the hotspot-compiler-dev mailing list