RFR: 8288022: c2: Transform (CastLL (AddL into (AddL (CastLL when possible

Tobias Hartmann thartmann at openjdk.org
Mon Jun 20 07:49:57 UTC 2022


On Mon, 13 Jun 2022 08:26:47 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> This implements a transformation that already exists for CastII and
> ConvI2L and helps code generation. The tricky part is that:
> 
> (CastII (AddI into (AddI (CastII
> 
> is performed by first computing the bounds of the type of the AddI. To
> protect against overflow, jlong variables are used. With CastLL/AddL
> nodes there's no larger integer type to promote the bounds to. As a
> consequence the logic in the patch explicitly tests for overflow. That
> logic is shared by the int and long cases. The previous logic for the
> int cases that promotes values to long is used as verification.
> 
> This patch also widens the type of CastLL nodes after loop opts the
> way it's done for CastII/ConvI2L to allow commoning of nodes.
> 
> This was observed to help with Memory Segment micro benchmarks.

Looks correct. A second review would be good.

test/hotspot/jtreg/compiler/c2/irTests/TestPushAddThruCast.java line 68:

> 66:         }
> 67: 
> 68:     }

Suggestion:

        }
    }

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

Marked as reviewed by thartmann (Reviewer).

PR: https://git.openjdk.org/jdk/pull/9139


More information about the hotspot-compiler-dev mailing list