RFR: 8349563: Improve AbsNode::Value() for integer types [v2]

Dean Long dlong at openjdk.org
Thu Apr 3 21:05:52 UTC 2025


On Wed, 19 Feb 2025 16:13:06 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Jasmine Karthikeyan has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
>> 
>>  - Merge
>>  - Improve AbsNode::Value
>
> src/hotspot/share/opto/subnode.cpp line 1941:
> 
>> 1939: 
>> 1940:   if (lo_abs < 0) {
>> 1941:     assert(lo_abs == std::numeric_limits<NativeType>::min(), "uabs(t->_lo) must be min value if negative!");
> 
> I think asserting `t->_lo` to be min is more straightforward, and also indicates `(t->_lo) + 1`, which yields max, is in the type. We can simplify the comment below too.

If we check for the problematic t->_lo == min first, then we no longer need to use uabs(), right?
Also, could we use IntegerType::MIN for the check, rather than std::numeric_limits?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23685#discussion_r2027739138


More information about the hotspot-compiler-dev mailing list