aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-10-19 01:24:18 +0000
committerNadav Rotem <nrotem@apple.com>2012-10-19 01:24:18 +0000
commit89e7b356f270e29c2e9e18c6bbd30e5925585f06 (patch)
tree920deb5b0ebd512db09c5a24a70c4e34e161dc44 /lib/Transforms/Vectorize/LoopVectorize.cpp
parentcbd9a19b5d6ff93efa82c467508ede78b8af3bac (diff)
vectorizer: Add support for reading and writing from the same memory location.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166255 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index f5c9bb31e0..5152ec11e5 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -715,6 +715,7 @@ bool LoopVectorizationLegality::canVectorizeBlock(BasicBlock &BB) {
ValueVector Reads;
ValueVector Writes;
+ SmallPtrSet<Value*, 16> AnalyzedPtrs;
unsigned NumPhis = 0;
for (BasicBlock::iterator it = BB.begin(), e = BB.end(); it != e; ++it) {
Instruction *I = it;
@@ -766,7 +767,10 @@ bool LoopVectorizationLegality::canVectorizeBlock(BasicBlock &BB) {
DEBUG(dbgs() << "LV: Found a non-simple load.\n");
return false;
}
- GetUnderlyingObjects(Ld->getPointerOperand(), Reads, DL);
+
+ Value* Ptr = Ld->getPointerOperand();
+ if (AnalyzedPtrs.insert(Ptr))
+ GetUnderlyingObjects(Ptr, Reads, DL);
}
// Record store pointers. Abort on all other instructions that write to
@@ -778,7 +782,10 @@ bool LoopVectorizationLegality::canVectorizeBlock(BasicBlock &BB) {
DEBUG(dbgs() << "LV: Found a non-simple store.\n");
return false;
}
- GetUnderlyingObjects(St->getPointerOperand(), Writes, DL);
+
+ Value* Ptr = St->getPointerOperand();
+ if (AnalyzedPtrs.insert(Ptr))
+ GetUnderlyingObjects(St->getPointerOperand(), Writes, DL);
}
// We still don't handle functions.