RFR: 8349563: Improve AbsNode::Value() for integer types

Dean Long dlong at openjdk.org
Thu Feb 27 02:41:06 UTC 2025


On Wed, 19 Feb 2025 05:10:04 GMT, Jasmine Karthikeyan <jkarthikeyan at openjdk.org> wrote:

> Hi all,
> This is a small patch that improves the implementation of Value() for `AbsINode` and `AbsLNode` by returning the absolute value of the input range. Most of the logic is trivial except for the special case where `_lo == jint_min/jlong_min` which must return the entire type range when encountered, for which I've added a small proof in the comments. I've also added some unit tests and updated the file to limit IR check platforms with more granularity.
> 
> Thoughts and reviews would be appreciated!

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

> 1936: 
> 1937:   NativeType lo_abs = uabs(t->_lo);
> 1938:   NativeType hi_abs = uabs(t->_hi);

Converting unsigned to signed is C++ Undefined Behavior, is it not?

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

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


More information about the hotspot-compiler-dev mailing list