[PATCH] D15718: Recognize pattern for ctpop in instcombine

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 11:17:19 PST 2016


majnemer added a comment.

In http://reviews.llvm.org/D15718#342877, @kparzysz wrote:

> To answer David's question: the main reason why it's here is that after the instruction combiner, the code is transformed in a way that makes the detection of the popcnt pattern more difficult.  At this stage, there is some regularity in the IR that can be exploited to check for popcnt patterns of varying widths.
>  As far as downstream optimizations are involved---this transformation will reduce code size by quite a bit, and any optimization that can be limited by code size could potentially be enabled by this change.


I am concerned that you will slow down InstCombine by a considerable margin by checking for PopCnt.  Most of the time, the work done to perform this optimization will not be fruitful.

We've recently been through a similar odyssey for bswap/bitreverse (see r257875).  We managed to move that logic to CGP without too much drama.


Repository:
  rL LLVM

http://reviews.llvm.org/D15718





More information about the llvm-commits mailing list