Fix a really subtle off-by-one bug that Duncan noticed with valgrind
authorChris Lattner <sabre@nondot.org>
Tue, 9 Dec 2008 04:47:21 +0000 (04:47 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 9 Dec 2008 04:47:21 +0000 (04:47 +0000)
on test/CodeGen/Generic/2007-06-06-CriticalEdgeLandingPad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60739 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 9b792c1aca9cc925c51e96ddeca2a2414ec3eb67..892b1c5b3be2981452cf41885b180d364402a99b 100644 (file)
@@ -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;
   }