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

Kangcheng Xu kxu at openjdk.org
Thu Mar 13 17:23:58 UTC 2025


On Thu, 13 Mar 2025 08:06:10 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Kangcheng Xu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   add micro benchmark
>
> src/hotspot/share/opto/addnode.cpp line 480:
> 
>> 478:     if (!con->is_Con()) {
>> 479:       swap(con, base);
>> 480:     }
> 
> Is that necessary? Does `Mul` not automatically get canonicalized so that the constant is on the rhs?

This is not related to `Mul` canonicalization. Swapping those two variables makes my next 4 lines syntactically easier to write. (So I don't have to do `(con->is_Con ? con : base)->is_top()` and so on.) This shouldn't be any more costly with a modern C++ compiler.

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

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


More information about the hotspot-compiler-dev mailing list