[PATCH] D143368: [InstCombine] Look through truncate to fold icmp with intrinsics

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 19:10:56 PST 2023


bcl5980 added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4920-4921
+    if (II->getIntrinsicID() == Intrinsic::ctpop ||
+        II->getIntrinsicID() == Intrinsic::cttz ||
+        II->getIntrinsicID() == Intrinsic::ctlz) {
+      // Make sure the dest bits is enough to save the intrinsic output's range
----------------
bcl5980 wrote:
> spatel wrote:
> > Require one less bit for cttz/ctlz when the "is_zero_poison" argument is true?
> https://alive2.llvm.org/ce/z/pQQavA
> It looks one less bit for cttz when is_zero_poison=true is wrong.
ah, I'm wrong. Should be llvm::Log2_32_Ceil(SrcBits - is_zero_poison), not Op0 bitwidth - is_zero_poison


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

https://reviews.llvm.org/D143368



More information about the llvm-commits mailing list