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

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Mon May 12 02:43:00 UTC 2025


On Mon, 7 Apr 2025 08:27:24 GMT, Damon Fenacci <dfenacci 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
>
> test/hotspot/jtreg/compiler/c2/irTests/TestIRAbs.java line 249:
> 
>> 247:     @DontCompile
>> 248:     public void checkIntRange(int i) {
>> 249:         Asserts.assertEquals(Math.abs((i & 7) - 4) > 4, testIntRange1(i));
> 
> Cool improvement @jaskarth!
> It might not be directly related to your optimization and marginally relevant but I was wondering if it would make sense to widen the choice of constants a bit (maybe adding few more or some randomly generated ones)?

Thanks for taking a look! Currently we're using the Generators API to create randomly distributed integers to test with (in `checkIntRanges`, from which `checkIntRange` is called) while the constants here are to force the AbsNode to have a range of `[-4, 3]` to ensure that it can be statically optimized away.

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

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


More information about the hotspot-compiler-dev mailing list