summaryrefslogtreecommitdiff
path: root/lib/Transforms/Vectorize
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
commite709f5b600fd630c4f58b5dba14c8069a03093ea (patch)
treea62919ba572af1112d185ef1137cee94becc8d0b /lib/Transforms/Vectorize
parentc83b5dc625bd85276a23c36c1fbad193203d2bc7 (diff)
downloadllvm-e709f5b600fd630c4f58b5dba14c8069a03093ea.tar.gz
llvm-e709f5b600fd630c4f58b5dba14c8069a03093ea.tar.bz2
llvm-e709f5b600fd630c4f58b5dba14c8069a03093ea.tar.xz
LoopVectorize: Add support for write-only loops when the write destination is a single pointer.
Speedup SciMark by 1% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167035 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index ac82a66b80..9e05cacbbe 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/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.