[PATCH] D142429: [InstCombine] Use `computeKnownBits` in `SimplifyDemandedUseBits` for and/xor/or

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 17:39:44 PST 2023


goldstein.w.n created this revision.
Herald added subscribers: foad, 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.

There are extra patterns that have for these three logic operations
that aren't covered in `SimplifyDemandedUseBits`. To avoid duplicating
the code, just use `computeKnownBits` in `SimplifyDemandedUseBits` to
get full coverage.

I think a preferable method would be just making helpers, but since
the helper for and/xor/or in `computeKnownBits` relies of being able
to call `computeKnownBits` I couldn't think of a better method.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142429

Files:
  llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  llvm/test/Analysis/ValueTracking/knownbits-and-or-xor-lowbit.ll
  llvm/test/Analysis/ValueTracking/knownbits-bmi-pattern.ll
  llvm/test/Transforms/InstCombine/and-or-xor-lowbit-simplified.ll
  llvm/test/Transforms/InstCombine/assume.ll
  llvm/test/Transforms/InstCombine/ctpop-pow2.ll
  llvm/test/Transforms/InstCombine/shift.ll
  llvm/test/Transforms/InstCombine/zext-or-icmp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142429.491577.patch
Type: text/x-patch
Size: 19333 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230124/0cb7030f/attachment.bin>


More information about the llvm-commits mailing list