aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Vectorize/VecUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Vectorize/VecUtils.cpp')
-rw-r--r--lib/Transforms/Vectorize/VecUtils.cpp10
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)