[PATCH] D150091: [InstCombine] Transform `icmp eq/ne ({su}div exact X,Y),C` -> `icmp eq/ne X, Y*C`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 7 23:53:09 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, spatel.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We can do this if `Y*C` doesn't overflow. This is trivial if `C` is
0/1. Otherwise we actually generate a `mul` instruction iff the `div`
has one use.

Alive2 Links:

  udiv: https://alive2.llvm.org/ce/z/GWPW67
  sdiv: https://alive2.llvm.org/ce/z/bUoX9h


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150091

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/sdiv-icmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150091.520265.patch
Type: text/x-patch
Size: 3934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230508/21dfffb7/attachment.bin>


More information about the llvm-commits mailing list