[PATCH] D139408: [InstCombine] Fold logic-and/logic-or by distributive laws
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 10:24:34 PST 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2704
+
+ // X && Z || Y && Z --> (X || Y) && Z
+ if (match(CondVal, m_LogicalAnd(m_Value(A), m_Value(B))) &&
----------------
Use the same names as the code for consistency:
// (A && B) || (C && B) --> (A || C) && B
With logical-and/or, the pattern is not commutative. I think the code is correct, but it might be better to put this kind of label just above the line that does the transform, so it is clear that order of the common operand does matter.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139408/new/
https://reviews.llvm.org/D139408
More information about the llvm-commits
mailing list