[PATCH] D112955: [InstCombine] (a & ~(b | c)) | ~(a | (b ^ c)) -> (~a & b & c) | ~(b | c)
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 1 13:32:56 PDT 2021
rampitec created this revision.
rampitec added a reviewer: spatel.
Herald added a subscriber: hiraditya.
rampitec requested review of this revision.
Herald added a project: LLVM.
----------------------------------------
define i2 @src(i2 %a, i2 %b, i2 %c) {
%0:
%or1 = or i2 %b, %c
%not1 = xor i2 %or1, 3
%and1 = and i2 %a, %not1
%xor1 = xor i2 %b, %c
%or2 = or i2 %xor1, %a
%not2 = xor i2 %or2, 3
%or3 = or i2 %and1, %not2
ret i2 %or3
}
>
=
define i2 @tgt(i2 %a, i2 %b, i2 %c) {
%0:
%1 = or i2 %b, %c
%2 = xor i2 %1, 3
%3 = and i2 %b, %c
%4 = xor i2 %a, 3
%5 = and i2 %3, %4
%or3 = or i2 %5, %2
ret i2 %or3
}
Transformation seems to be correct!
https://reviews.llvm.org/D112955
Files:
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/and-xor-or.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112955.383870.patch
Type: text/x-patch
Size: 8068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211101/8ce91852/attachment-0001.bin>
More information about the llvm-commits
mailing list