[llvm] r185041 - SLP: When searching for vectorization opportunities scan the blocks in post-order because we grow chains upwards.

Nadav Rotem nrotem at apple.com
Wed Jun 26 16:44:45 PDT 2013


Author: nadav
Date: Wed Jun 26 18:44:45 2013
New Revision: 185041

URL: http://llvm.org/viewvc/llvm-project?rev=185041&view=rev
Log:
SLP: When searching for vectorization opportunities scan the blocks in post-order because we grow chains upwards.

Modified:
    llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=185041&r1=185040&r2=185041&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Wed Jun 26 18:44:45 2013
@@ -1377,8 +1377,10 @@ struct SLPVectorizer : public FunctionPa
     // 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);





More information about the llvm-commits mailing list