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

Kangcheng Xu kxu at openjdk.org
Mon Mar 17 19:18:25 UTC 2025


On Thu, 13 Mar 2025 17:21:06 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:

>> 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.

Obsolete after refactored to use `find_simple_lshift_pattern`.

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

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


More information about the hotspot-compiler-dev mailing list