From ab105ae95fc473c19d9f0b019fc7c7a16d17b1a5 Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Sun, 14 Apr 2013 05:15:53 +0000 Subject: 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 --- lib/Transforms/Vectorize/VecUtils.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/Transforms/Vectorize/VecUtils.cpp') diff --git a/lib/Transforms/Vectorize/VecUtils.cpp b/lib/Transforms/Vectorize/VecUtils.cpp index 4d075c5..584f3d9 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(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(Ty)->getNumElements(); i < e; ++i) -- cgit v1.1