RFR: 8349361: C2: RShiftL should support all applicable transformations that RShiftI does [v11]

Emanuel Peter epeter at openjdk.org
Thu Mar 13 07:29:07 UTC 2025


On Mon, 10 Mar 2025 13:32:40 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> This change refactors `RShiftI`/`RshiftL` `Ideal`, `Identity` and
>> `Value` because the `int` and `long` versions are very similar and so
>> there's no logic duplication. In the process, support for some extra
>> transformations is added to `RShiftL`. I also added some new test
>> cases.
>
> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 20 additional commits since the last revision:
> 
>  - review  + test fix
>  - review
>  - Merge branch 'master' into JDK-8349361
>  - review
>  - Merge branch 'master' into JDK-8349361
>  - review
>  - review
>  - review
>  - Merge branch 'master' into JDK-8349361
>  - Update src/hotspot/share/opto/mulnode.cpp
>    
>    Co-authored-by: Emanuel Peter <emanuel.peter at oracle.com>
>  - ... and 10 more: https://git.openjdk.org/jdk/compare/8d64f5f3...34e925b3

Did another quick scan. Will launch some testing now.

src/hotspot/share/opto/mulnode.cpp line 1412:

> 1410: }
> 1411: 
> 1412: Node *RShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) {

Suggestion:

Node* RShiftINode::Ideal(PhaseGVN* phase, bool can_reshape) {

test/hotspot/jtreg/compiler/c2/irTests/RShiftLNodeIdealizationTests.java line 79:

> 77:         long x9 = Integer.max(Integer.min((int)x, (int)test7Max), (int)(test7Min-1));
> 78:         Asserts.assertEQ((x9 << test7Shift) >> test7Shift, test9(x));
> 79:          Asserts.assertEQ(((x7 << test7Shift) >> test10Shift), test10(x));

Suggestion:

        Asserts.assertEQ(((x7 << test7Shift) >> test10Shift), test10(x));

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

Changes requested by epeter (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/23438#pullrequestreview-2680790106
PR Review Comment: https://git.openjdk.org/jdk/pull/23438#discussion_r1992925220
PR Review Comment: https://git.openjdk.org/jdk/pull/23438#discussion_r1992929457


More information about the hotspot-compiler-dev mailing list