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

David Goldblatt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 21 11:19:27 PDT 2021


davidtgoldblatt added a comment.

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

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

Yep, that should be fine, thank you.

> 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

I.e. pull out the signedness checks into `bool NoOverflow` or something, and additionally set `NoOverflow` to true if the X in X * Y / Y or X * Y % Y is of the form A / Y? I think we still need to check the specific operation (to decide to reduce to X or 0), but I think it does get us some extra cases we can simplify. Happy to do so if you'd prefer, although my initial thought is that it's a little complex for a case I don't know I've seen.


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