[lworld] RFR: 8376708: [lworld] Missed Ideal optimization around CmpL
Benoît Maillard
bmaillard at openjdk.org
Fri Feb 20 10:40:29 UTC 2026
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!
-------------
Commit messages:
- Comment
- Remove debug comment
- Add summary
- Add to worklist in parsing
- Add test
Changes: https://git.openjdk.org/valhalla/pull/2145/files
Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2145&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8376708
Stats: 66 lines in 2 files changed: 66 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/valhalla/pull/2145.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2145/head:pull/2145
PR: https://git.openjdk.org/valhalla/pull/2145
More information about the valhalla-dev
mailing list