[PATCH] D150100: [KnownBits] Improve implementation of `KnownBits::abs`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 20:00:44 PDT 2023


goldstein.w.n marked 3 inline comments as done.
goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Support/KnownBits.cpp:426
+    // NB: KnownAbs is not always a subset of KnownNeg so we want to get input
+    // from both.
+    KnownAbs.One |= KnownNeg.One;
----------------
goldstein.w.n wrote:
> nikic wrote:
> > Under which circumstance is KnownAbs better? Seems fishy.
> > Under which circumstance is KnownAbs better? Seems fishy.
> 
> The output sign at the very least. But when testing (even when I was getting the right sign from the `computeForAddSub` `assert(KnownAbs.Zero.isSubsetOf(KnownNeg.Zero) && KnownAbs.isSubsetOf(KnownNeg.One))` was failing on the exhaustive tests.
Its just the sign bit, ill update comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150100



More information about the llvm-commits mailing list