LoopVectorize: Fix a bug in the scalarization of instructions.
[oota-llvm.git] / lib / Transforms / Vectorize / LoopVectorize.cpp
index ee544b3a7f1232d59f74b5597174599f4ae34492..827c13ffc9f8640f5d16507c18c8349a5a5aefcc 100644 (file)
@@ -284,7 +284,7 @@ void InnerLoopVectorizer::scalarizeInstruction(Instruction *Instr) {
 
     // If the src is an instruction that appeared earlier in the basic block
     // then it should already be vectorized.
-    if (SrcInst && SrcInst->getParent() == Instr->getParent()) {
+    if (SrcInst && OrigLoop->contains(SrcInst)) {
       assert(WidenMap.count(SrcInst) && "Source operand is unavailable");
       // The parameter is a vector value from earlier.
       Params.push_back(WidenMap[SrcInst]);