[PATCH] D154306: [InstCombine] Generalise ((x1 ^ y1) | (x2 ^ y2)) == 0 transform to more than two pairs of variables
Maksim Kita via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 6 09:23:15 PDT 2023
kitaisreal marked an inline comment as done.
kitaisreal added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2038
+ // ((X1 ^ X2) || (X3 ^ X4) || (X5 ^ X6)) == 0 --> (X1 == X2) && (X3 == X4) && (X5 == X6)
+ // ((X1 ^ X2) || (X3 ^ X4) || (X5 ^ X6)) != 0 --> (X1 != X2) || (X3 != X4) || (X5 != X6)
+ bool Match = false;
----------------
goldstein.w.n wrote:
> Maybe add as a todo, but this also works for `sub` (or implement in a follow up patch!)
I can implement this in follow up patch.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2066
+
+ if (!OrLhsIsXor && !OrRhsIsXor) {
+ break;
----------------
goldstein.w.n wrote:
> There could we a case where we have:
>
> `(or (or (xor A, B), (xor C, D)), (or (xor E, F), (xor G, H)))`.
> Not sure if it worth handling this case, but maybe switch this to a worklist algo so you can arbitrarily add `Or` ops.
Updated implementation to support such case.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154306/new/
https://reviews.llvm.org/D154306
More information about the llvm-commits
mailing list