[PATCH] D102864: [InstSimplify] Transform X * Y % Y --> 0.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 21 12:56:53 PDT 2021


spatel added a comment.

In D102864#2773521 <https://reviews.llvm.org/D102864#2773521>, @spatel wrote:

> define i8 @src(i8 %a, i8 %y) {
>
>   %x = sdiv i8 %a, %y
>   %mul = mul i8 %x, %y
>   %mod = srem i8 %mul, %y
>   ret i8 %mod
>
> }
> Interestingly, it looks like we currently miscompile that pattern in instcombine.

For reference, that miscompile appears to be only with an undef input. We have a mul transform that creates an extra use of the numerator op, so we need to freeze it to make the transform safe.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102864



More information about the llvm-commits mailing list