mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 02:25:19 +00:00
Apply slp vectorization on fully-vectorizable tree of height 2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191852 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -311,6 +311,10 @@ private:
|
||||
/// \returns a vector from a collection of scalars in \p VL.
|
||||
Value *Gather(ArrayRef<Value *> VL, VectorType *Ty);
|
||||
|
||||
/// \returns whether the VectorizableTree is fully vectoriable and will
|
||||
/// be beneficial even the tree height is tiny.
|
||||
bool isFullyVectorizableTinyTree();
|
||||
|
||||
struct TreeEntry {
|
||||
TreeEntry() : Scalars(), VectorizedValue(0), LastScalarIndex(0),
|
||||
NeedToGather(0) {}
|
||||
@@ -917,15 +921,28 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
|
||||
}
|
||||
}
|
||||
|
||||
bool BoUpSLP::isFullyVectorizableTinyTree() {
|
||||
DEBUG(dbgs() << "SLP: Check whether the tree with height " <<
|
||||
VectorizableTree.size() << " is fully vectorizable .\n");
|
||||
|
||||
// We only handle trees of height 2.
|
||||
if (VectorizableTree.size() != 2)
|
||||
return false;
|
||||
|
||||
// Gathering cost would be too much for tiny trees.
|
||||
if (VectorizableTree[0].NeedToGather || VectorizableTree[1].NeedToGather)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int BoUpSLP::getTreeCost() {
|
||||
int Cost = 0;
|
||||
DEBUG(dbgs() << "SLP: Calculating cost for tree of size " <<
|
||||
VectorizableTree.size() << ".\n");
|
||||
|
||||
// Don't vectorize tiny trees. Small load/store chains or consecutive stores
|
||||
// of constants will be vectoried in SelectionDAG in MergeConsecutiveStores.
|
||||
// The SelectionDAG vectorizer can only handle pairs (trees of height = 2).
|
||||
if (VectorizableTree.size() < 3) {
|
||||
// We only vectorize tiny trees if it is fully vectorizable.
|
||||
if (VectorizableTree.size() < 3 && !isFullyVectorizableTinyTree()) {
|
||||
if (!VectorizableTree.size()) {
|
||||
assert(!ExternalUses.size() && "We should not have any external users");
|
||||
}
|
||||
|
Reference in New Issue
Block a user