diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-04-14 05:15:53 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-04-14 05:15:53 +0000 |
commit | ab105ae95fc473c19d9f0b019fc7c7a16d17b1a5 (patch) | |
tree | 27247e73ffdef91c52268c935d65afd7c066c1c0 /lib/Transforms/Vectorize/VecUtils.cpp | |
parent | 618eda7a60bafff7741a988e27b98bf81d27cb89 (diff) |
SLPVectorizer: Add support for trees that don't start at binary operators, and add the cost of extracting values from the roots of the tree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize/VecUtils.cpp')
-rw-r--r-- | lib/Transforms/Vectorize/VecUtils.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/VecUtils.cpp b/lib/Transforms/Vectorize/VecUtils.cpp index 4d075c505d..584f3d9778 100644 --- a/lib/Transforms/Vectorize/VecUtils.cpp +++ b/lib/Transforms/Vectorize/VecUtils.cpp @@ -173,6 +173,16 @@ bool BoUpSLP::vectorizeStores(StoreList &Stores, int costThreshold) { return Changed; } +int BoUpSLP::getScalarizationCost(ValueList &VL) { + Type *ScalarTy = VL[0]->getType(); + + if (StoreInst *SI = dyn_cast<StoreInst>(VL[0])) + ScalarTy = SI->getValueOperand()->getType(); + + VectorType *VecTy = VectorType::get(ScalarTy, VL.size()); + return getScalarizationCost(VecTy); +} + int BoUpSLP::getScalarizationCost(Type *Ty) { int Cost = 0; for (unsigned i = 0, e = cast<VectorType>(Ty)->getNumElements(); i < e; ++i) |