Integrated: 8352893: C2: OrL/INode::add_ring optimize (x | -1) to -1

Manuel Hässig duke at openjdk.org
Wed Apr 2 06:33:15 UTC 2025


On Fri, 28 Mar 2025 10:21:57 GMT, Manuel Hässig <duke at openjdk.org> wrote:

> # Issue Summary
> 
> The `add_ring()` implementations of `OrINode` and `OrLNode` are missing the optimization that an or with a value where all bits are ones (since we have signed integers in this case `~0 == -1`) will always yield all zeroes.
> 
> # Changes
> 
> This PR makes the following straight forward changes:
>  - `Or(I|L)Node::add_ring()` returns `-1` if one of the two inputs is `-1`.
>  - Add `Or(I|L)` nodes to the IR framework.
>  - Add a regression IR test for the implemented optimization.
> 
> # Testing
> 
> - [Github Actions](https://github.com/mhaessig/jdk/actions/runs/14110978686)
> - Ran tier1 through tier3 and Oracle internal testing

This pull request has now been integrated.

Changeset: f301663b
Author:    Manuel Hässig <manuel.hassig at oracle.com>
URL:       https://git.openjdk.org/jdk/commit/f301663b346bf2388ecfa429be1cf64c6e93ee8e
Stats:     109 lines in 3 files changed: 109 ins; 0 del; 0 mod

8352893: C2: OrL/INode::add_ring optimize (x | -1) to -1

Reviewed-by: epeter, thartmann, kvn

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

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


More information about the hotspot-compiler-dev mailing list