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

Chen Liang liach at openjdk.org
Thu Jan 23 16:31:47 UTC 2025


On Thu, 23 Jan 2025 08:18:27 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> 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?
>
> @j3graham can you give us an explanation here?

This is how the existing code worked - the bounded handling came before this bool handling.  This bool restriction has been here since the earliest publication of OpenJDK, I think.  I believe a professional with gvn knows better about this than maybe j3graham, who seems not as familiar.

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

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


More information about the hotspot-compiler-dev mailing list