RFR: 8322589: Add Ideal transformation: (~a) & (~b) => ~(a | b) [v5]
Tobias Hartmann
thartmann at openjdk.org
Mon Jan 8 07:01:25 UTC 2024
On Fri, 5 Jan 2024 21:43:39 GMT, Zhiqiang Zang <duke at openjdk.org> wrote:
>> Hello,
>>
>> `(~a) & (~b) => ~(a | b)` is a widely seen pattern, for example it is implemented for LLVM [here](https://github.com/llvm/llvm-project/blob/397f1ce9efb4eea1ee10fe4833f733b8c7abd878/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp#L1616C28-L1616C28); however it is missing in current implementation of hotspot. This pull request adds this transformation and associated tests.
>>
>> Thanks.
>
> Zhiqiang Zang has updated the pull request incrementally with one additional commit since the last revision:
>
> update the copyright dates.
Looks good to me otherwise.
src/hotspot/share/opto/mulnode.cpp line 615:
> 613: // Convert "(~a) & (~b)" into "~(a | b)"
> 614: if (AddNode::is_not(phase, in(1), T_INT) && AddNode::is_not(phase, in(2), T_INT)) {
> 615: Node *or_a_b = new OrINode(in(1)->in(1), in(2)->in(1));
Suggestion:
Node* or_a_b = new OrINode(in(1)->in(1), in(2)->in(1));
Same below.
-------------
Marked as reviewed by thartmann (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/16333#pullrequestreview-1808105721
PR Review Comment: https://git.openjdk.org/jdk/pull/16333#discussion_r1444223718
More information about the hotspot-compiler-dev
mailing list