]> granicus.if.org Git - llvm/commit
[DAGCombiner] (REAPPLIED) Add vector demanded elements support to computeKnownBits
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 29 Oct 2016 11:29:39 +0000 (11:29 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 29 Oct 2016 11:29:39 +0000 (11:29 +0000)
commit6722cc3c8a4e16c9c5b09734afd223bf76b9f56b
treec67860c913932d84a76c625c2b1e3bd24654071a
parent2fd63302fec84fcc7e02aeff2ea0959ea25a9775
[DAGCombiner] (REAPPLIED) 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.

This looked like this had caused compile time regressions on some buildbots (and was reverted in rL285381), but appears to have just been a harmless bystander!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285494 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