RFR: 8325495: C2: implement optimization for series of Add of unique value [v8]
Christian Hagedorn
chagedorn at openjdk.org
Tue Oct 8 07:13:03 UTC 2024
On Mon, 7 Oct 2024 18:44:41 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:
>> src/hotspot/share/opto/addnode.cpp line 567:
>>
>>> 565:
>>> 566: // We can't simply return the lshift node even if ((a << CON) - a) + a cancels out. Ideal() must return a new node.
>>> 567: *multiplier = ((jlong) 1 << con->get_int()) - 1;
>>
>> Can't this be an `Identity()` transformation where you can return existing nodes?
>
> Good point. I realized `(x - y) + y => x` is already handled by `AddINode::Identity` and `AddLNode::Identify`. I don't need to repeat here.
That's great!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20754#discussion_r1791317004
More information about the hotspot-compiler-dev
mailing list