[PATCH] D150921: [KnownBits] Cleanup some misspelling / logic in {u,s}div
    Noah Goldstein via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu May 18 17:44:40 PDT 2023
    
    
  
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Support/KnownBits.cpp:580
+    if (!Denom.isZero())
+      Res = Num.sdiv(Denom);
     if (*ResultSign) {
----------------
@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
================
Comment at: llvm/lib/Support/KnownBits.cpp:586
+      }
       Known.makeNonNegative();
     } else {
----------------
@foad, re:
> Don't need this, or the makeNegative call below.
Needed for the same reason as above.
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