Insert the reduction start value into the first bypass block to preserve domination.

Fixes PR15344.

llvm-svn: 176701
This commit is contained in:
Benjamin Kramer
2013-03-08 16:58:37 +00:00
parent 5e524897ed
commit 37c2d65c5a
2 changed files with 36 additions and 1 deletions

View File

@@ -1643,7 +1643,7 @@ InnerLoopVectorizer::vectorizeLoop(LoopVectorizationLegality *Legal) {
// To do so, we need to generate the 'identity' vector and overide
// one of the elements with the incoming scalar reduction. We need
// to do it in the vector-loop preheader.
Builder.SetInsertPoint(LoopBypassBlocks.back()->getTerminator());
Builder.SetInsertPoint(LoopBypassBlocks.front()->getTerminator());
// This is the vector-clone of the value that leaves the loop.
VectorParts &VectorExit = getVectorValue(RdxDesc.LoopExitInstr);