LoopVectorizer: Keep track of conditional store basic blocks

Before conditional store vectorization/unrolling we had only one
vectorized/unrolled basic block. After adding support for conditional store
vectorization this will not only be one block but multiple basic blocks. The
last block would have the back-edge. I updated the code to use a vector of basic
blocks instead of a single basic block and fixed the users to use the last entry
in this vector. But, I forgot to add the basic blocks to this vector!

Fixes PR18724.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201028 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Arnold Schwaighofer
2014-02-08 20:41:13 +00:00
parent e09411dd68
commit 846acbeef1
2 changed files with 44 additions and 0 deletions

View File

@ -1640,6 +1640,7 @@ void InnerLoopVectorizer::scalarizeInstruction(Instruction *Instr, bool IfPredic
Cmp = Builder.CreateExtractElement(Cond[Part], Builder.getInt32(Width));
Cmp = Builder.CreateICmp(ICmpInst::ICMP_EQ, Cmp, ConstantInt::get(Cmp->getType(), 1));
CondBlock = IfBlock->splitBasicBlock(InsertPt, "cond.store");
LoopVectorBody.push_back(CondBlock);
VectorLp->addBasicBlockToLoop(CondBlock, LI->getBase());
// Update Builder with newly created basic block.
Builder.SetInsertPoint(InsertPt);
@ -1668,6 +1669,7 @@ void InnerLoopVectorizer::scalarizeInstruction(Instruction *Instr, bool IfPredic
// End if-block.
if (IfPredicateStore) {
BasicBlock *NewIfBlock = CondBlock->splitBasicBlock(InsertPt, "else");
LoopVectorBody.push_back(NewIfBlock);
VectorLp->addBasicBlockToLoop(NewIfBlock, LI->getBase());
Builder.SetInsertPoint(InsertPt);
Instruction *OldBr = IfBlock->getTerminator();
@ -5736,6 +5738,7 @@ void InnerLoopUnroller::scalarizeInstruction(Instruction *Instr,
Cmp = Builder.CreateICmp(ICmpInst::ICMP_EQ, Cond[Part],
ConstantInt::get(Cond[Part]->getType(), 1));
CondBlock = IfBlock->splitBasicBlock(InsertPt, "cond.store");
LoopVectorBody.push_back(CondBlock);
VectorLp->addBasicBlockToLoop(CondBlock, LI->getBase());
// Update Builder with newly created basic block.
Builder.SetInsertPoint(InsertPt);
@ -5761,6 +5764,7 @@ void InnerLoopUnroller::scalarizeInstruction(Instruction *Instr,
// End if-block.
if (IfPredicateStore) {
BasicBlock *NewIfBlock = CondBlock->splitBasicBlock(InsertPt, "else");
LoopVectorBody.push_back(NewIfBlock);
VectorLp->addBasicBlockToLoop(NewIfBlock, LI->getBase());
Builder.SetInsertPoint(InsertPt);
Instruction *OldBr = IfBlock->getTerminator();