[PATCH] D150921: [KnownBits] Cleanup some misspelling / logic in {u,s}div

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 01:51:05 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Support/KnownBits.cpp:580
+    if (!Denom.isZero())
+      Res = Num.sdiv(Denom);
     if (*ResultSign) {
----------------
goldstein.w.n wrote:
> @foad, re:
> > At this point the sign of Res should match ResultSign, so you don't need a std::optional, you could just have a "bool ResultSignKnown".
> 
> Since `Denom` now can be zero (result of not using strictlypositive), we can't just grab the sign from the result so keeping as optional bool
I think you can copy what you do in udiv - if the min value of denom is 0, treat it as 1 (since if the value was really 0, the result would be poison).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150921



More information about the llvm-commits mailing list