[PATCH] D64037: [IR][PatternMatch] introduce m_Unless() matcher

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 03:24:03 PDT 2019


lebedev.ri added a comment.

In D64037#1566247 <https://reviews.llvm.org/D64037#1566247>, @RKSimon wrote:

> In D64037#1566201 <https://reviews.llvm.org/D64037#1566201>, @lebedev.ri wrote:
>
> > In D64037#1566190 <https://reviews.llvm.org/D64037#1566190>, @RKSimon wrote:
> >
> > > Do you have a specific usecase in mind?
> >
> >
> > Yes, absolutely. I don't submit patches otherwise.
>
>
> Please can you update the dependency on this patch to point to the usecases?


I didn't post that patch yet. It comes up when fixing PR42466 <https://bugs.llvm.org/show_bug.cgi?id=42466>
We have `icmp eq/ne (and (shl X, Y), Z), 0`, and if `X` is not a constant we want to turn it into `icmp eq/ne (and (lshr Z, Y), X), 0`.
But the problem is that if we do the obvious thing and directly patternmatch that, and *then* check that `X` is not a constant (and not fold if it is),
we then won't check whether `Z` is also a `(shl Q, X)` with `Q` not being a constant, and this we have missed commutative case..


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64037/new/

https://reviews.llvm.org/D64037





More information about the llvm-commits mailing list