RFR: 8373555: C2: Optimize redundant input calculations for sign comparisons

Galder Zamarreño galder at openjdk.org
Thu Dec 18 15:52:06 UTC 2025


On Fri, 12 Dec 2025 08:14:28 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

> Instead of sign-comparisons with And,Or,Xor,Max,Min nodes, we can directly compare to one of the inputs of the binary nodes if the other input is irrelevant to the comparison.
> 
> There are potentially more operations, but these mentioned here are the most obvious ones. Max and Min could theoretically be expanded to arbitrary comparisons to constants, but I didn't want to introduce more complexity for now.
> 
> Please let me know what you think :)

Neat! At a glance I don't see anything wrong. Just a small question: what testing did you carry out?

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

PR Review: https://git.openjdk.org/jdk/pull/28782#pullrequestreview-3593681301


More information about the hotspot-compiler-dev mailing list