Integrated: 8364766: C2: Improve Value() of DivI and DivL for non-constant inputs

Tobias Hotz duke at openjdk.org
Thu Dec 18 07:40:08 UTC 2025


On Sun, 6 Jul 2025 08:08:25 GMT, Tobias Hotz <duke at openjdk.org> wrote:

> This PR improves the value of interger division nodes.
> Currently, we only emit a good type if either input is constant. But we can also cover the generic case. It does that by finding the four corners of the division. This is guranteed to find the extrema that we can use for min/max. Some special logic is required for MIN_INT / -1, though, as this is a special case
> We also need some special logic to handle ranges that cross zero, but in this case, we just need to check for the negative and positive range once.
> This also cleans up and unifies the code paths for DivINode and DivLNode.
> I've added some tests to validate the optimization. Without the changes, some of these tests fail.

This pull request has now been integrated.

Changeset: 85983069
Author:    Tobias Hotz <tobias.hotz at hotmail.de>
Committer: Manuel Hässig <mhaessig at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/859830694b3db0b81b422bf9b2ce9c7ab9a19a85
Stats:     717 lines in 2 files changed: 613 ins; 90 del; 14 mod

8364766: C2: Improve Value() of DivI and DivL for non-constant inputs

Reviewed-by: mhaessig, epeter, bmaillard

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

PR: https://git.openjdk.org/jdk/pull/26143


More information about the hotspot-compiler-dev mailing list