[PATCH] D45173: [InstCombine] Recognize idioms for ctpop and ctlz

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 6 10:02:46 PDT 2018


kparzysz added a comment.

In https://reviews.llvm.org/D45173#1059947, @lebedev.ri wrote:

> In https://reviews.llvm.org/D45173#1059921, @kparzysz wrote:
>
> > Moving aggressive instcombine pass to before the regular instcombine, just to demonstrate the idea.
>
>
> I'm curious to know, while this does sidestep the issue of having to adapt to the instcombine/earlier passes being smarter, how does this not either [...]


The patterns that we're trying to match correspond to some "typical implementations", so it's not intended to detect any possible computation that, for example, calculates population count.  Different popcount algorithms would obviously need different matching codes.  That's not a loss, since instcombine cannot now and likely will never be able to reorganize entire algorithms into a common way.  The big problem with instcombine now is that its ongoing development results in a continuous stream of small changes to the output which then require ongoing adjustments to the matching code.  Look at HexagonLoopIdiomRecognition.cpp to see the extent to which it goes to try and see through what instcombine has done.


Repository:
  rL LLVM

https://reviews.llvm.org/D45173





More information about the llvm-commits mailing list