RFR: 8352893: C2: OrL/INode::add_ring optimize (x | -1) to -1 [v2]
Emanuel Peter
epeter at openjdk.org
Mon Mar 31 14:05:39 UTC 2025
On Mon, 31 Mar 2025 14:02:45 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
>
> Manuel Hässig has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix bug number in regression test
@mhaessig It looks good, just two comments below :)
test/hotspot/jtreg/compiler/integerArithmetic/TestOrSaturate.java line 32:
> 30: /*
> 31: * @test
> 32: * @bug 8352839
Suggestion:
* @bug 8352893
Werchstabeverbuechslig ;)
test/hotspot/jtreg/compiler/integerArithmetic/TestOrSaturate.java line 47:
> 45: @Run(test = {"testL", "testI", "testDelayed"})
> 46: public static void check() {
> 47: for (int i = 0; i < WARMUP; i++) {
Do you actually need the WARMUP here? It does not look like this is a standalone test, so I thought the `@Run` actually gets called many times. Not sure if that is correct...
-------------
Changes requested by epeter (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/24289#pullrequestreview-2729391754
PR Review Comment: https://git.openjdk.org/jdk/pull/24289#discussion_r2021095658
PR Review Comment: https://git.openjdk.org/jdk/pull/24289#discussion_r2021099459
More information about the hotspot-compiler-dev
mailing list