]> granicus.if.org Git - llvm/commit
[DAGCombiner] Add vector demanded elements support to computeKnownBits
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 27 Oct 2016 14:29:28 +0000 (14:29 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 27 Oct 2016 14:29:28 +0000 (14:29 +0000)
commit5579104d091dc270f4cd0b5b02c42425bc9e6a5e
tree13d7c419ac0fa22e6730cb218b49391193c521e3
parentd44b990d122dc68c772f574626cb977be34b6c48
[DAGCombiner] Add vector demanded elements support to computeKnownBits

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.

DemandedElts support could similarly be added to computeKnownBitsForTargetNode in a future commit.

Differential Revision: https://reviews.llvm.org/D25691

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285296 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/X86/avx-vperm2x128.ll
test/CodeGen/X86/known-bits-vector.ll