[PATCH] Added InstCombine transform for pattern " ((X % Z) + (Y % Z)) % Z -> (X + Y) % Z ".

Nuno Lopes nunoplopes at sapo.pt
Sat Oct 11 02:58:32 PDT 2014


Sorry, still not correct:

Pre: WillNotOverflowSignedAdd(%x, %y)
%1 = srem %x, %z
%2 = srem %y, %z
%3 = add %1, %2
%r = srem %3, %z
  =>
%6 = add %x, %y
%r = srem %6, %z

Done: 1
ERROR: Domain of definedness of Target is smaller than Source's for i2 %r

Example:
%x i2 = 3 (0x3)
%z i2 = 3 (0x3)
%y i2 = 3 (0x3)
%1 i2 = 0 (0x0)
%2 i2 = 0 (0x0)
%3 i2 = 0 (0x0)
%6 i2 = 2 (0x2)
Source value: 0 (0x0)
Target value: undef

http://reviews.llvm.org/D5351






More information about the llvm-commits mailing list