Insert the reduction start value into the first bypass block to preserve domination.
[oota-llvm.git] / lib / Transforms / Vectorize / LoopVectorize.cpp
index 0d11372808456318d5e467323f9b00d72fa12406..11f4b0220457ff2b3bace92c99b8645daf792448 100644 (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);