[PATCH] D73718: [SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model UDiv by power-of-two as LShr

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 07:31:12 PST 2020


lebedev.ri added a comment.

To be noted, there is a number of other shortcuts we //could// cost-model:

- `... + (-1 * ...)` -> `... - ...` <-  likely very frequent case
- `rem x, power-of-2`, which is currently `x - ((x udiv y) * y)` -> `x & log2(power-of-2)-1`
- `x - (rem x, power-of-2)`, which is currently `(x udiv y) * y` -> `x & -log2(power-of-2)`
- `... * power-of-2` -> `... << log2(power-of-2)` <- likely not very beneficial


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73718





More information about the llvm-commits mailing list