[PATCH] D46031: [DAGCombiner] DON'T unfold scalar masked merge if 'B' is constant

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 25 07:47:09 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D46031#1078128, @spatel wrote:

> It's not clear to me if this is about xor with a constant in general or xor with -1 specifically.


I thought in general, note the tests with constant `42`.

> Is the motivating pattern/problem not recognizing DeMorgan's Laws folds in the DAG?

The motivational case is specified in the differential's description,

>   ; ~(~x & y) --> x | ~y
>   %notx = xor i8 %x, -1
>   %and = and i8 %notx, %y
>   %r = xor i8 %and, -1
>   =>
>   %notm = xor i8 %y, -1
>   %r = or i8 %x, %notm
>   
> 
> 
> That seems like a good fold to have in the DAG given that we're rearranging bitwise logic ops to better match target features. Should we just add that (and the 'or' --> 'and' twin)?

Hmm, not sure, let's see..


Repository:
  rL LLVM

https://reviews.llvm.org/D46031





More information about the llvm-commits mailing list