[PATCH] D63004: [TargetLowering] Simplify (ctpop x) == 1

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 9 08:02:49 PDT 2019


spatel added a comment.

In D63004#1534341 <https://reviews.llvm.org/D63004#1534341>, @xbolva00 wrote:

> @spatel Maybe we should just expand in it instcombine? I found something interesting...


There needs to be justification for expansion of the intrinsic in IR. For example, the expansion allows further pattern matching/folds within instcombine that are made more difficult/impossible when the code uses the intrinsic. That would then have to be weighed against the likely harm caused to inlining/unrolling based on the IR cost models.

> Even with this patch, f1 and f2 variants are not same (execution time), f2 is much faster. If I disable loop vectorization, there are almost same. Maybe loop vectorizer cannot handle ctpop very well? @craig.topper

That sounds like a vectorizer or cost model bug/enhancement rather than a good reason to change IR canonicalization.


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

https://reviews.llvm.org/D63004





More information about the llvm-commits mailing list