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 | 54b413d157cb22ce949db12c3cdcfe997355f3d5 (patch) | |
tree | b4d0140e1cc614332a13668a958d11a1945937e3 /llvm/lib/Transforms/Vectorize/VecUtils.cpp | |
parent | c3c28f8599f56c91974000f8044bf392beb753e5 (diff) | |
download | bcm5719-llvm-54b413d157cb22ce949db12c3cdcfe997355f3d5.tar.gz bcm5719-llvm-54b413d157cb22ce949db12c3cdcfe997355f3d5.zip |
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.
llvm-svn: 179475
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/VecUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/VecUtils.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VecUtils.cpp b/llvm/lib/Transforms/Vectorize/VecUtils.cpp index 4d075c505d2..584f3d97788 100644 --- a/llvm/lib/Transforms/Vectorize/VecUtils.cpp +++ b/llvm/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) |