[PATCH] D68189: [InstCombine] recognize popcount implemented in hacker's delight.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 04:38:15 PDT 2019


lebedev.ri added a comment.

In D68189#1687354 <https://reviews.llvm.org/D68189#1687354>, @shchenz wrote:

> In D68189#1687190 <https://reviews.llvm.org/D68189#1687190>, @xbolva00 wrote:
>
> > >> Maybe we need to add TargetTransformInfo in InstCombiner to make sure this combination only happens when getPopcntSupport is true.
> >
> > Atleast on X86 it is not needed, since popcount expander expands intrinsic to exactly this pattern.
> >
> > https://godbolt.org/z/i-rswr
>
>
> Thanks, yes it should be ok on powerpc and X86. But I am afraid there are some platforms which do not have hardware popcount, and we folding many arithmetical operations into one intrinsic, thus we may miss some combination/canonicalization opportunities for these arithmetical operations on such platform. I am not sure ^-^


No. This is a canonicalization pass. Native LLVM IR intrinsic is more canonical than some IR blob.


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

https://reviews.llvm.org/D68189





More information about the llvm-commits mailing list