diff options
| author | Nadav Rotem <nrotem@apple.com> | 2012-10-19 01:24:18 +0000 | 
|---|---|---|
| committer | Nadav Rotem <nrotem@apple.com> | 2012-10-19 01:24:18 +0000 | 
| commit | ced93f3a05a6a5e74fa8ef3f4d00f1cfa3fae237 (patch) | |
| tree | dc80aef9554261055dcdde39b8fe6e867ca55634 /llvm/lib | |
| parent | 282c92a7089f44429e878f880968c765e8e211cd (diff) | |
| download | bcm5719-llvm-ced93f3a05a6a5e74fa8ef3f4d00f1cfa3fae237.tar.gz bcm5719-llvm-ced93f3a05a6a5e74fa8ef3f4d00f1cfa3fae237.zip  | |
vectorizer: Add support for reading and writing from the same memory location.
llvm-svn: 166255
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 11 | 
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index f5c9bb31e05..5152ec11e5b 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/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.  | 

