[PATCH] D143417: [InstCombine] Add fold for `(rem (mul/shl X, Y), (mul/shl X, Z))` -> `(mul X, (rem Y, Z))`
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 09:50:48 PST 2023
goldstein.w.n created this revision.
Herald added a subscriber: 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.
Forked from D142901 <https://reviews.llvm.org/D142901> to handle the `mul`/`shl` when `Y` and `Z` are
non-constant.
`(srem (mul/shl X, Y), (mul/shl X, Z))`
[If `Y`/`Z` are one use]
-> `(mul/shl nuw nsw X, (srem Y, Z))`
- https://alive2.llvm.org/ce/z/ccTFj2
- https://alive2.llvm.org/ce/z/i_UQ5A
-> `(mul/shl nsw X, (srem Y, Z))`
- https://alive2.llvm.org/ce/z/mQKc63
- https://alive2.llvm.org/ce/z/uERkKH
`(urem (mul/shl X, Y), (mul/shl X, Z))`
[If `Y`/`Z` are one use]
-> `(mul/shl nuw nsw X, (srem Y, Z))`
- https://alive2.llvm.org/ce/z/mNnQqJ
- https://alive2.llvm.org/ce/z/Bj_DR-
- https://alive2.llvm.org/ce/z/X6ZEtQ
-> `(mul/shl nuw X, (srem Y, Z))`
- https://alive2.llvm.org/ce/z/SJYtUV
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143417
Files:
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/urem-mul.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143417.495189.patch
Type: text/x-patch
Size: 9182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230206/956a644e/attachment.bin>
More information about the llvm-commits
mailing list