[PATCH] D122077: [InstCombine] Fold (ctpop(X) == 1) | (X == 0) into ctpop(X) < 2

Hirochika Matsumoto via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 12:07:47 PDT 2022


hkmatsumoto updated this revision to Diff 417705.
hkmatsumoto added a comment.

Reflect code reviews

- Factor out pattern matching code and exit early if it didn't match
- Rename foldOrOfCtpop to foldIsPowerOf2OrZero
- Rename 2 tests in ispow2.ll to is_pow2_or_zero(_logical) to inform that this patch optimizes them


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122077

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/icmp-or.ll
  llvm/test/Transforms/InstCombine/ispow2.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122077.417705.patch
Type: text/x-patch
Size: 8884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220323/be8d3268/attachment.bin>


More information about the cfe-commits mailing list