[PATCH] D22918: [Loop Vectorizer] Support predication of div/rem

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 09:58:37 PDT 2016


anemet added a subscriber: anemet.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3825-3834
@@ -3781,10 +3824,12 @@
 
-  // Predicate any stores.
-  for (auto KV : PredicatedStores) {
+  // Predicate any instructions.
+  for (auto KV : PredicatedInstructions) {
     BasicBlock::iterator I(KV.first);
-    auto *BB = SplitBlock(I->getParent(), &*std::next(I), DT, LI);
+    BasicBlock *Head = I->getParent();
+    auto *BB = SplitBlock(Head, &*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");
+    // Try to move any extract-element we may have created for the predicated
+    // instruction into the Then block.
+    for (unsigned In = 0; In < I->getNumOperands(); ++In) {
----------------
Only a drive-by comment, please don't make vectorizeLoop any more unreadable than it already is.  Please consider prequel to this patch that moves store-predication into its own function.


https://reviews.llvm.org/D22918





More information about the llvm-commits mailing list