RFR: 8278114: New addnode ideal optimization: converting "x + x" into "x << 1" [v3]

Zhiqiang Zang duke at openjdk.java.net
Thu Dec 16 17:39:03 UTC 2021


On Wed, 8 Dec 2021 19:31:35 GMT, Zhiqiang Zang <duke at openjdk.java.net> wrote:

>> A new ideal optimization can be introduced for addnode: converting "x + x" into "x << 1".
>> 
>> 
>> // Convert "x + x" into "x << 1"
>> if (in1 == in2) {
>>   return new LShiftINode(in1, phase->intcon(1));
>> }
>
> Zhiqiang Zang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
> 
>  - Merge master.
>  - enrich tests and do the same transformation for "long".
>  - include a new optimization for ideal in addnode: Convert "x + x" into "x << 1", and associated tests.

@merykitty If you get a chance could you please take a quick look at this PR? I was wondering if this conversion makes sense. I am concerned if this obvious optimization has been done somewhere else which I was not able to find. Thank you very much.

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

PR: https://git.openjdk.java.net/jdk/pull/6675


More information about the hotspot-compiler-dev mailing list