summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/VecUtils.cpp
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
commit86e848c849e21f0d0009aeadbe71a8ab6b4e9ef2 (patch)
treee57b63cb696ace5749820cfde9ed6b1a3813c1f6 /llvm/lib/Transforms/Vectorize/VecUtils.cpp
parent18e8cf433528f103e7e1022b2b7a6b92bc037c41 (diff)
downloadbcm5719-llvm-86e848c849e21f0d0009aeadbe71a8ab6b4e9ef2.tar.gz
bcm5719-llvm-86e848c849e21f0d0009aeadbe71a8ab6b4e9ef2.zip
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%. llvm-svn: 184317
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/VecUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/VecUtils.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VecUtils.cpp b/llvm/lib/Transforms/Vectorize/VecUtils.cpp
index 2f6b7df21b6..1e97ed400be 100644
--- a/llvm/lib/Transforms/Vectorize/VecUtils.cpp
+++ b/llvm/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) {
OpenPOWER on IntegriCloud