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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 25 07:38:46 PDT 2018


spatel added a comment.

It's not clear to me if this is about xor with a constant in general or xor with -1 specifically. Is the motivating pattern/problem not recognizing DeMorgan's Laws folds in the DAG?

  ; ~(~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)?


Repository:
  rL LLVM

https://reviews.llvm.org/D46031





More information about the llvm-commits mailing list