RFR: 8347645: C2: XOR bounded value handling blocks constant folding [v4]

Chen Liang liach at openjdk.org
Thu Jan 23 00:26:52 UTC 2025


On Wed, 22 Jan 2025 20:23:02 GMT, Johannes Graham <duke at openjdk.org> wrote:

>> C2 does not eliminate XOR nodes with constant arguments. This has a noticeable effect on `Long.expand` with a constant mask, on architectures that don't have instructions equivalent  to `PDEP` to be used in an intrinsic.
>> 
>> This patch demonstrates a potential fix to the problem, but there might well be better ways to do it.
>
> Johannes Graham has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix test names

src/hotspot/share/opto/addnode.cpp line 1013:

> 1011:     if( r0 == TypeInt::BOOL && ( r1 == TypeInt::ONE
> 1012:                                  || r1 == TypeInt::BOOL))
> 1013:       return TypeInt::BOOL;

@eme64 Can you verify that it's right for the bounded value handling to come before this boolean range checking, and the bounded value handling is still correct if one of the input arguments is constant?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23089#discussion_r1926165109


More information about the hotspot-compiler-dev mailing list