[PATCH] D150093: [KnownBits] Add implementation for `KnownBits::sdiv`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 17:13:32 PDT 2023


goldstein.w.n added a comment.

In D150093#4326402 <https://reviews.llvm.org/D150093#4326402>, @nikic wrote:

> FWIW, if we know the sign bits of sdiv, we should really always be converting it to udiv. We actually already do this in CVP, and should also implement the same in InstCombine. It currently only handles the non-negative case, but the others can be implemented by adding the necessary negations.

I saw that. It increases instruction count though. It's also hard to undo in the backend and results in worse codegen. I was planning to make a patch to actually stop doing it for non-constant operands because of that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150093



More information about the llvm-commits mailing list