[PATCH] D149196: [SelectionDAG] Use `computeKnownBits` if `Op` is not recognized by `isKnownNeverZero`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 08:35:17 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5020
 
-  return false;
+  return !computeKnownBits(Op, Depth - 1).One.isZero();
 }
----------------
foad wrote:
> craig.topper wrote:
> > `return computeKnownBits(Op, Depth - 1).isNonZero()`. KnownBits already has a wrapper so we don't have to reference the `One` field directly.
> It would be less confusing overall to *not* increment Depth.
I think in this case is but it makes it so that in all the recursive cases you can just copy `Depth` rather than `Depth + 1`. Its also what we do in `ValueTracking` to think it makes sense to keep it similiar.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149196



More information about the llvm-commits mailing list