RFR: 8327381: Refactor type-improving transformations in BoolNode::Ideal to BoolNode::Value [v11]

Kangcheng Xu kxu at openjdk.org
Mon Jul 8 16:49:39 UTC 2024


On Tue, 18 Jun 2024 14:26:32 GMT, Kangcheng Xu <kxu at openjdk.org> wrote:

>> This PR resolves [JDK-8327381](https://bugs.openjdk.org/browse/JDK-8327381)
>> 
>> Currently the transformations for expressions with patterns `((x & m) u<= m)` or `((m & x) u<= m)` to `true` is in `BoolNode::Ideal` function with a new constant node of value `1` created. However, this is technically a type-improving (reduction in range) transformation that's better suited in `BoolNode::Value` function.
>> 
>> New unit test `test/hotspot/jtreg/compiler/c2/TestBoolNodeGvn.java` asserting on IR nodes and correctness of this transformation is added and passing.
>
> Kangcheng Xu 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:
> 
>  - Merge branch 'master' into boolnode-refactor
>  - update test values, @run directive, and remove an empty line
>  - Merge branch 'master' into boolnode-refactor
>  - move test location, add negative test case, simplify imports
>  - Merge branch 'master' into boolnode-refactor
>  - refactor BoolNode::Value() and extract code to ::Value_cmpu_and_mask
>  - update comments
>  - fix indentation again
>  - apply test only on x64, aarch64 and riscv64
>  - also renames the class name in @run
>  - ... and 10 more: https://git.openjdk.org/jdk/compare/c47dfb29...715a6304

I pushed a commit to spread test cases compounded with `&` and `|` into subcases to avoid optimizing out semantically equivalent ones and to make test clearer. To make test passing even with `CmpU3` miscounted as `CmpU`, I specified `counts = {IRNode.CMP_U, ">=1"}` instead of strictly `1`. I hope this is acceptable.

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

PR Comment: https://git.openjdk.org/jdk/pull/18198#issuecomment-2214675206


More information about the hotspot-compiler-dev mailing list