RFR: 8261008: Optimize Xor

Eric Liu github.com+10482586+therealeliu at openjdk.java.net
Mon Mar 1 14:26:48 UTC 2021


On Mon, 1 Mar 2021 12:56:24 GMT, Bernardo Sulzbach <github.com+8271090+bernardosulzbach at openjdk.org> wrote:

> If we agree that this optimization is desired, then it makes sense to also write optimizations for `x - x` and `x | x`.
> 
> However, how often do these patterns occur in real code? Can you provide some examples (of source code from OSS projects) where `x ^ x`, `x - x`, or `x | x` occur?

Thanks for your feedback. I didn't find them in real cases. This case was discussed in https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2020-November/041798.html.

To persue the optimal code, it could be done without too much effort.

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

PR: https://git.openjdk.java.net/jdk/pull/2776


More information about the hotspot-compiler-dev mailing list