[lworld] Integrated: 8376708: [lworld] Missed Ideal optimization around CmpL

Benoît Maillard bmaillard at openjdk.org
Mon Feb 23 10:24:11 UTC 2026


On Fri, 20 Feb 2026 10:19:53 GMT, Benoît Maillard <bmaillard at openjdk.org> wrote:

> This PR adresses a missed optimization in `CmpLNode::Ideal`. It occurs when when we encode a pointer comparison as `CmpL(OrL(left, right), 0L)` (which essentially translates to "both operands are null") during parsing in `do_acmp`, and this comparison can later be folded to a constant in `CmpLNode::Ideal` because one of the operands has a `NotNull` type. This optimization hides behind `can_reshape`, so it can only be carried out during IGVN and not during the initial GVN pass.  To fix this, we just need to make sure to add the compare to the worklist during parsing.
> 
> ### Testing
> - [x] GitHub Actions
> - [x] tier1-3, plus some internal testing
> 
> Thank you for reviewing!

This pull request has now been integrated.

Changeset: 8e7d911d
Author:    Benoît Maillard <bmaillard at openjdk.org>
Committer: Tobias Hartmann <thartmann at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/8e7d911d403d0a00f65d0728a21cff6af71a62ce
Stats:     67 lines in 2 files changed: 67 ins; 0 del; 0 mod

8376708: [lworld] Missed Ideal optimization around CmpL

Reviewed-by: thartmann

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

PR: https://git.openjdk.org/valhalla/pull/2145


More information about the valhalla-dev mailing list