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

Zhiqiang Zang duke at openjdk.java.net
Fri Dec 17 17:52:57 UTC 2021


> 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 eight commits:

 - update mircobenchmark to reflect the new optimization.
 - include ir tests.
 - remove test for the removed optimization.
 - replace (x + x) -> x >> 1 with (x + x) >> c -> x >> (c + 1).
 - Merge master.
 - 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.

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

Changes: https://git.openjdk.java.net/jdk/pull/6675/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6675&range=03
  Stats: 309 lines in 6 files changed: 302 ins; 0 del; 7 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6675.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6675/head:pull/6675

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


More information about the hotspot-compiler-dev mailing list