[PATCH] D45655: [InstCombine][RFC] Canonicalize constant mask in masked merge mattern

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 03:54:37 PDT 2018


lebedev.ri abandoned this revision.
lebedev.ri added a comment.

In https://reviews.llvm.org/D45655#1071003, @spatel wrote:

> See my comment in https://reviews.llvm.org/D45733. Sorry that I didn't get a chance to review/discuss this sooner.
>
> I doubt the premise that this pattern should exist in the first place, so I suspect we don't want to add logic to transform it. But if it does exist, then and/and/or is the best canonical form for the IR - it's better for bit-tracking analysis and better for codegen.


After further disscussion in https://reviews.llvm.org/D45733, yes, probably.
One more reason - the pattern could be `(x & C1) | (y & C2)`, where `C1` and `C2` don't have common bits set, so the result will have `~(C1|C2)` bits unset.
And we would not be able to efficiently fold that to `((x^y)&m)^y`.
So yeah, let's unfold it for constants.


Repository:
  rL LLVM

https://reviews.llvm.org/D45655





More information about the llvm-commits mailing list