[PATCH] D24419: [InstCombine] use commutative matchers for patterns with commutative operators
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 22 14:51:40 PDT 2016
spatel added a comment.
In https://reviews.llvm.org/D24419#550173, @sanjoy wrote:
> Have you considered treating this as a canonicalization problem? That is, always canonicalize `(X & A) | (A ^ Y)` to `(A & X) | (A ^ Y)` (for all commutative ops)?
Hmmm...no, I didn't think of that. Can you describe the rule that we would use with this example?
This case is the 2nd to last code diff in this patch:
// (A & ~B) ^ (~A & B) -> A ^ B
// (~B & A) ^ (~A & B) -> A ^ B
I'm not sure how to canonicalize this without possibly conflicting with other canonicalization rules based on operand complexity. Ie, we order binop operands depending on whether they are themselves binop/unop/params/constants.
https://reviews.llvm.org/D24419
More information about the llvm-commits
mailing list