diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 9b792c1aca9..892b1c5b3be 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -249,7 +249,7 @@ void LoopStrengthReduce::DeleteTriviallyDeadInstructions() { for (unsigned i = 0, e = DeadInsts.size()-1; i < e; ++i) { Instruction *I = DeadInsts[i]; if (!I->use_empty()) DeadInsts[i] = 0; - while (DeadInsts[i+1] == I && i != e) + while (i != e && DeadInsts[i+1] == I) DeadInsts[++i] = 0; }