diff options
author | Nadav Rotem <nrotem@apple.com> | 2013-06-26 23:44:45 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2013-06-26 23:44:45 +0000 |
commit | 70d695801a2bd5eed4bd6ea05d40516e6e6fa276 (patch) | |
tree | c513f8b578a1e5bb61d0bb55cc0b10d75b1aac5e | |
parent | 1e1c694dcd934aa63a0b1e27e01293dcfc610f40 (diff) | |
download | llvm-70d695801a2bd5eed4bd6ea05d40516e6e6fa276.tar.gz llvm-70d695801a2bd5eed4bd6ea05d40516e6e6fa276.tar.bz2 llvm-70d695801a2bd5eed4bd6ea05d40516e6e6fa276.tar.xz |
SLP: When searching for vectorization opportunities scan the blocks in post-order because we grow chains upwards.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185041 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Vectorize/SLPVectorizer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 3c1dc78bc4..6ffd34bbf5 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1377,8 +1377,10 @@ struct SLPVectorizer : public FunctionPass { // he store instructions. FuncSLP R(&F, SE, DL, TTI, AA, LI, DT); - for (Function::iterator it = F.begin(), e = F.end(); it != e; ++it) { - BasicBlock *BB = it; + // Scan the blocks in the function in post order. + for (po_iterator<BasicBlock*> it = po_begin(&F.getEntryBlock()), + e = po_end(&F.getEntryBlock()); it != e; ++it) { + BasicBlock *BB = *it; // Vectorize trees that end at reductions. Changed |= vectorizeChainsInBlock(BB, R); |