RFR: 8347555: [REDO] C2: implement optimization for series of Add of unique value [v7]
Emanuel Peter
epeter at openjdk.org
Wed Apr 2 10:29:07 UTC 2025
On Thu, 13 Mar 2025 17:16:14 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:
>> src/hotspot/share/opto/addnode.cpp line 407:
>>
>>> 405: }
>>> 406:
>>> 407: // Try to convert a serial of additions into a single multiplication. Also convert `(a * CON) + a` to `(CON + 1) * a` as
>>
>> What about `(a * CON1) + (a * CON2)`? Like `11 * a + 5 * a`. Do we also optimize that?
>
> `AddNode::IdealIL` handles to more general associative patterns like `(a*b) + (a*c)` into `a*(b + c)`
Ah interesting. It could be worth adding a comment for that here then!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23506#discussion_r2024516603
More information about the hotspot-compiler-dev
mailing list