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

Hirochika Matsumoto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 20 01:19:53 PDT 2022


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

Address code reviews

- Fold (icmp ne ctpop(X) 1) & (icmp ne X 0) into (icmp ugt ctpop(X) 1) as well

foldOrOfCtpop folds the aforementioned pattern into (icmp **uge** ctpop(X) 2)
and that is later transformed into (icmp ugt ctpop(X) 1). I think this is fine.

- Add tests for vector type


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.416762.patch
Type: text/x-patch
Size: 8816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220320/813c5e2b/attachment.bin>


More information about the llvm-commits mailing list