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

Emanuel Peter epeter at openjdk.org
Tue Mar 12 16:25:15 UTC 2024


On Mon, 11 Mar 2024 16:52:07 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 incrementally with one additional commit since the last revision:
> 
>   fix test by adding the missing inversion
>   
>   also excluding negative values for unsigned comparison

Looks like a reasonable idea. Running tests now. Will review afterwards.

src/hotspot/share/opto/subnode.cpp line 1812:

> 1810:     int cop = cmp->Opcode();
> 1811:     Node *cmp1 = cmp->in(1);
> 1812:     Node *cmp2 = cmp->in(2);

Suggestion:

    Node* cmp1 = cmp->in(1);
    Node* cmp2 = cmp->in(2);

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

Changes requested by epeter (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18198#pullrequestreview-1931549333
PR Review Comment: https://git.openjdk.org/jdk/pull/18198#discussion_r1521763748


More information about the hotspot-compiler-dev mailing list