[PATCH] D89952: [SelectionDAG] Fine tune CTPOP optimizations

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 09:55:33 PDT 2020


spatel added a comment.

In D89952#2347710 <https://reviews.llvm.org/D89952#2347710>, @spatel wrote:

>> ctpop(x) > (any size >= element size) --> always false
>> ctpop(x) < (any size >= element size + 1) --> always true
>
> AFAICT, this always works for scalars, but not vectors. There's a chain reaction of transforms, but that is not triggered for vectors because range metadata doesn't support vectors:
> http://llvm.org/docs/LangRef.html#range-metadata
>
> We can add an explicit fold to instsimplify to make this direct/consistent.

Looking a bit closer: there's a more general bit of analysis in ValueTracking that seems to be missing that should solve this part. I'll post a patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89952



More information about the llvm-commits mailing list