summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2012-10-30 18:36:45 +0000
committerNadav Rotem <nrotem@apple.com>2012-10-30 18:36:45 +0000
commitbc21aceb19f0b446a978d6a032ebc59db6b84091 (patch)
treebe9f0dc93297f8d4f00c6e11c30862cde3c18282 /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
parent5c043aeb1b3511f17fb048036abb55e5b883b228 (diff)
downloadbcm5719-llvm-bc21aceb19f0b446a978d6a032ebc59db6b84091.tar.gz
bcm5719-llvm-bc21aceb19f0b446a978d6a032ebc59db6b84091.zip
LoopVectorize: Add support for write-only loops when the write destination is a single pointer.
Speedup SciMark by 1% llvm-svn: 167035
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index ac82a66b805..9e05cacbbe9 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1348,6 +1348,13 @@ bool LoopVectorizationLegality::canVectorizeMemory(BasicBlock &BB) {
Reads.push_back(Ptr);
}
+ // If we write (or read-write) to a single destination and there are no
+ // other reads in this loop then is it safe to vectorize.
+ if (ReadWrites.size() == 1 && Reads.size() == 0) {
+ DEBUG(dbgs() << "LV: Found a write-only loop!\n");
+ return true;
+ }
+
// Now that the pointers are in two lists (Reads and ReadWrites), we
// can check that there are no conflicts between each of the writes and
// between the writes to the reads.
OpenPOWER on IntegriCloud