RFR: 8261008: Optimize Xor
Tobias Hartmann
thartmann at openjdk.java.net
Wed Mar 3 14:35:46 UTC 2021
On Tue, 2 Mar 2021 10:54:53 GMT, Eric Liu <github.com+10482586+theRealELiu at openjdk.org> wrote:
>> `x - x` is already optimized: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/subnode.cpp#L96
>> `x | x` - here: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/addnode.cpp#L781
>>
>> For `x ^ x` Value() method should be used as for SubNode.
>
>> `x - x` is already optimized: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/subnode.cpp#L96
>> `x | x` - here: https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/addnode.cpp#L781
>>
>> For `x ^ x` Value() method should be used as for SubNode.
>
> Thanks for your review. I moved those codes into `Value()` and will update after some tests finished.
I think C2 optimizations could lead to IR shapes containing that pattern even if the Java source code does not. In any case, such simple patterns should be optimized and as Vladimir mentioned, it should be a `::Value` optimization.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2776
More information about the hotspot-compiler-dev
mailing list