RFR: 8327381: Refactor type-improving transformations in BoolNode::Ideal to BoolNode::Value [v11]
Christian Hagedorn
chagedorn at openjdk.org
Wed Jun 26 07:00:21 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/ac06c5f8...715a6304
I've run some testing again and the newly added test failed on all platforms in tier2:
compiler/c2/gvn/TestBoolNodeGVN.java
Additionally required flags:
-XX:-TieredCompilation
Maybe you need to increase the warm-up.
Output:
One or more @IR rules failed:
Failed IR Rules (1) of Methods (1)
----------------------------------
1) Method "public static boolean compiler.c2.gvn.TestBoolNodeGVN.testShouldHaveCpmU(int,int)" - [Failed IR rules: 1]:
* @IR rule 1: "@compiler.lib.ir_framework.IR(phase={AFTER_PARSING}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={"_#CMP_U#_", "4"}, applyIfPlatform={}, failOn={}, applyIfPlatformOr={"x64", "true", "aarch64", "true", "riscv64", "true"}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
> Phase "After Parsing":
- counts: Graph contains wrong number of nodes:
* Constraint 1: "(\\d+(\\s){2}(CmpU.*)+(\\s){2}===.*)"
- Failed comparison: [found] 2 = 4 [given]
- Matched nodes (2):
* 31 CmpU === _ 23 27 [[ 32 ]] !jvms: TestBoolNodeGVN::testShouldHaveCpmU @ bci:9 (line 66)
* 60 CmpU === _ 23 57 [[ 61 ]] !jvms: TestBoolNodeGVN::testShouldHaveCpmU @ bci:44 (line 68)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18198#issuecomment-2190955907
More information about the hotspot-compiler-dev
mailing list