[PATCH] D23013: [Loop Vectorizer] Move store-predication into its own function, remove obsolete comment (NFC)

Gil Rapaport via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 06:31:28 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL277595: [Loop Vectorizer] Move store-predication into its own function, removeā€¦ (authored by gilr).

Changed prior to commit:
  https://reviews.llvm.org/D23013?vs=66313&id=66655#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23013

Files:
  llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Index: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -367,6 +367,9 @@
   /// See PR14725.
   void fixLCSSAPHIs();
 
+  /// Predicate conditional stores on their respective conditions.
+  void predicateStores();
+ 
   /// Shrinks vector element sizes based on information in "MinBWs".
   void truncateToMinimalBitwidths();
 
@@ -3847,17 +3850,8 @@
   // Make sure DomTree is updated.
   updateAnalysis();
 
-  // Predicate any stores.
-  for (auto KV : PredicatedStores) {
-    BasicBlock::iterator I(KV.first);
-    auto *BB = SplitBlock(I->getParent(), &*std::next(I), DT, LI);
-    auto *T = SplitBlockAndInsertIfThen(KV.second, &*I, /*Unreachable=*/false,
-                                        /*BranchWeights=*/nullptr, DT, LI);
-    I->moveBefore(T);
-    I->getParent()->setName("pred.store.if");
-    BB->setName("pred.store.continue");
-  }
-  DEBUG(DT->verifyDomTree());
+  predicateStores();
+
   // Remove redundant induction instructions.
   cse(LoopVectorBody);
 }
@@ -4023,6 +4017,19 @@
                             LoopMiddleBlock);
   }
 }
+ 
+void InnerLoopVectorizer::predicateStores() {
+  for (auto KV : PredicatedStores) {
+    BasicBlock::iterator I(KV.first);
+    auto *BB = SplitBlock(I->getParent(), &*std::next(I), DT, LI);
+    auto *T = SplitBlockAndInsertIfThen(KV.second, &*I, /*Unreachable=*/false,
+                                        /*BranchWeights=*/nullptr, DT, LI);
+    I->moveBefore(T);
+    I->getParent()->setName("pred.store.if");
+    BB->setName("pred.store.continue");
+  }
+  DEBUG(DT->verifyDomTree());
+}
 
 InnerLoopVectorizer::VectorParts
 InnerLoopVectorizer::createEdgeMask(BasicBlock *Src, BasicBlock *Dst) {
@@ -5101,7 +5108,6 @@
       }
     }
 
-    // We don't predicate stores at the moment.
     if (I.mayWriteToMemory()) {
       auto *SI = dyn_cast<StoreInst>(&I);
       // We only support predication of stores in basic blocks with one


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23013.66655.patch
Type: text/x-patch
Size: 2103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160803/a6457948/attachment.bin>


More information about the llvm-commits mailing list