summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2013-06-19 15:57:29 +0000
committerNadav Rotem <nrotem@apple.com>2013-06-19 15:57:29 +0000
commit7d180ac7b6135bd378739dc2f760a5b31cd12cae (patch)
treea35b4fce4382d7f03231c3a7492bdc1effa00908 /lib
parent7391366cdf55ca5f5faf97a9ac2b01da47e2749c (diff)
downloadllvm-7d180ac7b6135bd378739dc2f760a5b31cd12cae.tar.gz
llvm-7d180ac7b6135bd378739dc2f760a5b31cd12cae.tar.bz2
llvm-7d180ac7b6135bd378739dc2f760a5b31cd12cae.tar.xz
SLPVectorizer: start constructing chains at stores that are not power of two.
The type <3 x i8> is a common in graphics and we want to be able to vectorize it. This changes accelerates bullet by 12% and 471_omnetpp by 5%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184317 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Vectorize/VecUtils.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Transforms/Vectorize/VecUtils.cpp b/lib/Transforms/Vectorize/VecUtils.cpp
index 2f6b7df21b..1e97ed400b 100644
--- a/lib/Transforms/Vectorize/VecUtils.cpp
+++ b/lib/Transforms/Vectorize/VecUtils.cpp
@@ -104,6 +104,8 @@ bool BoUpSLP::isConsecutiveAccess(Value *A, Value *B) {
}
bool BoUpSLP::vectorizeStoreChain(ArrayRef<Value *> Chain, int CostThreshold) {
+ unsigned ChainLen = Chain.size();
+ DEBUG(dbgs()<<"SLP: Analyzing a store chain of length " <<ChainLen<< "\n");
Type *StoreTy = cast<StoreInst>(Chain[0])->getValueOperand()->getType();
unsigned Sz = DL->getTypeSizeInBits(StoreTy);
unsigned VF = MinVecRegSize / Sz;
@@ -112,8 +114,8 @@ bool BoUpSLP::vectorizeStoreChain(ArrayRef<Value *> Chain, int CostThreshold) {
bool Changed = false;
// Look for profitable vectorizable trees at all offsets, starting at zero.
- for (unsigned i = 0, e = Chain.size(); i < e; ++i) {
- if (i + VF > e) return Changed;
+ for (unsigned i = 0, e = ChainLen; i < e; ++i) {
+ if (i + VF > e) break;
DEBUG(dbgs()<<"SLP: Analyzing " << VF << " stores at offset "<< i << "\n");
ArrayRef<Value *> Operands = Chain.slice(i, VF);
@@ -128,7 +130,19 @@ bool BoUpSLP::vectorizeStoreChain(ArrayRef<Value *> Chain, int CostThreshold) {
}
}
- return Changed;
+ if (Changed)
+ return true;
+
+ int Cost = getTreeCost(Chain);
+ if (Cost < CostThreshold) {
+ DEBUG(dbgs() << "SLP: Found store chain cost = "<< Cost <<" for size = " <<
+ ChainLen << "\n");
+ Builder.SetInsertPoint(getInsertionPoint(getLastIndex(Chain, ChainLen)));
+ vectorizeTree(Chain, ChainLen);
+ return true;
+ }
+
+ return false;
}
bool BoUpSLP::vectorizeStores(ArrayRef<StoreInst *> Stores, int costThreshold) {