[llvm] r277595 - [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:23:43 PDT 2016
Author: gilr
Date: Wed Aug 3 08:23:43 2016
New Revision: 277595
URL: http://llvm.org/viewvc/llvm-project?rev=277595&view=rev
Log:
[Loop Vectorizer] Move store-predication into its own function, remove obsolete comment (NFC)
Differential Revision: https://reviews.llvm.org/D23013
Modified:
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=277595&r1=277594&r2=277595&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Wed Aug 3 08:23:43 2016
@@ -367,6 +367,9 @@ protected:
/// 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 @@ void InnerLoopVectorizer::vectorizeLoop(
// 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 @@ void InnerLoopVectorizer::fixLCSSAPHIs()
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 @@ bool LoopVectorizationLegality::blockCan
}
}
- // 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
More information about the llvm-commits
mailing list