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

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 9 05:41:54 PDT 2018


kparzysz added a comment.

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

> To point the obvious, if one takes one of these tests, runs those through instcombine
>  and then runs aggressiveinstcombine, chances are they will no longer be matched...
>  (Well, the main point being, any non-expected, slightly different pattern, that i would normally expected to be slightly canonicalized beforehand),


I'm still not sure what your argument is.  The idea here is that the aggressive instcombine (or generally, complex pattern matching code) will always run before instcombine.  Yes, the fact that instcombine will change something in the code being matched is exactly what this idea is trying to avoid.  Instcombine is a continuously evolving pass that keeps changing the IR.  Any matching code running after it needs to be continuously updated to reflect those changes.  This is a **big** problem for any non-trivial pattern matching.  Running such pattern matching before instcombine does not eliminate the need for updates (if the preceding passes change), but significantly reduced the frequency of such updates.


Repository:
  rL LLVM

https://reviews.llvm.org/D45173





More information about the llvm-commits mailing list