[PATCH] D25691: [DAGCombiner] Add vector demanded elements support to computeKnownBits

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 17 12:16:32 PDT 2016

RKSimon created this revision.
RKSimon added reviewers: bogner, niravd, majnemer, eli.friedman, spatel, andreadb.
RKSimon added a subscriber: llvm-commits.
RKSimon set the repository for this revision to rL LLVM.

Currently computeKnownBits returns the common known zero/one bits for all elements of vector data, when we may only be interested in one/some of the elements.

This patch adds a DemandedElts argument that allows us to specify the elements we actually care about. The original computeKnownBits implementation calls with a DemandedElts demanding all elements to match current behaviour. Scalar types set this to 1.

The approach was found to be easier than trying to add a per-element known bits solution, for a similar usefulness given the combines where computeKnownBits is typically used.

I've only added support for a few opcodes so far (the ones that have proven straightforward to test), all others will default to demanding all elements but can be updated in due course.

I could add DemandedElts support to computeKnownBitsForTargetNode in this patch if required (this could be useful for x86 target shuffles...).




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25691.74885.patch
Type: text/x-patch
Size: 14667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161017/295c16e7/attachment.bin>

More information about the llvm-commits mailing list