[InstCombine] allow vectors for masked-add -> xor fold
authorSanjay Patel <spatel@rotateright.com>
Tue, 17 Nov 2020 18:24:47 +0000 (13:24 -0500)
committerSanjay Patel <spatel@rotateright.com>
Tue, 17 Nov 2020 18:36:08 +0000 (13:36 -0500)
commit4a66a1d17abfb7cf34081f0620cb2f53b40cca97
tree237f263e8740528403f687720828324cccc2adba
parent49e0de5f6fe6470523576fb01d38021ea2957260
[InstCombine] allow vectors for masked-add -> xor fold

https://rise4fun.com/Alive/I4Ge

  Name: add with pow2 mask
  Pre: isPowerOf2(C2) && (C1 & C2) != 0 && (C1 & (C2-1)) == 0
  %a = add i8 %x, C1
  %r = and i8 %a, C2
  =>
  %n = and i8 %x, C2
  %r = xor i8 %n, C2
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/test/Transforms/InstCombine/and.ll