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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 21 05:24:01 PDT 2021


spatel added a comment.

In D102864#2772310 <https://reviews.llvm.org/D102864#2772310>, @davidtgoldblatt wrote:

> I don't have commit access. Happy to split this in two and do two diffs if you'd prefer, though.

No problem. I can commit on your behalf. To confirm - use your gmail address for author info?

Would it make sense to unify this with the related div transforms? If I'm seeing it correctly, we could also pick up this (and unsigned sibling) transform if we can generalize that block:
https://alive2.llvm.org/ce/z/AvaDGJ

  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
  }
  
  define i8 @tgt(i8 %x, i8 %y) {
    ret i8 0
  }

Interestingly, it looks like we currently miscompile that pattern in instcombine.


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