[PATCH] D24419: [InstCombine] use commutative matchers for patterns with commutative operators
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 2 15:04:32 PDT 2016
sanjoy added a comment.
In https://reviews.llvm.org/D24419#550211, @spatel wrote:
> 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.
Yeah, I can't come up with a scheme that will obviously not clash with
InstCombine's operand complexity order.
An alternative may be to canonicalize "internally" -- that is first
split the expression into `(Op0 ITy0 Op1) ITy1 (Op2 ITy2 Op3)` (that
is, "explode" the contents of the operation into local variables) and
then `std::swap` the `Op0` / `Op1` or the `Op2` / `Op3` pairs in
whatever order that makes matching these easier. That may involve too
much refactoring though.
https://reviews.llvm.org/D24419
More information about the llvm-commits
mailing list