[PATCH] D157309: [ValueTracking] Do more thorough non-zero check in `isKnownToBePowerOfTwo` when `OrZero` is no set.

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 10:49:04 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, Allen.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We can cover more cases by directly checking if the result is
known-nonzero for common patterns when they are missing `OrZero`.

This patch add `isKnownNonZero` checks for `shl`, `lshr`, `and`, and `mul`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157309

Files:
  llvm/lib/Analysis/ValueTracking.cpp
  llvm/test/Analysis/ValueTracking/known-power-of-two.ll
  llvm/test/Transforms/InstSimplify/ctpop-pow2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157309.547856.patch
Type: text/x-patch
Size: 5953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230807/38201659/attachment.bin>


More information about the llvm-commits mailing list