prepare for a change I'm about to make
authorChris Lattner <sabre@nondot.org>
Sat, 28 Oct 2006 00:59:20 +0000 (00:59 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 28 Oct 2006 00:59:20 +0000 (00:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31248 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index e498860b5e830723450faca5a60ba3a286e111d3..1c6acc6eef81148d39e43f4115fcab817e9364de 100644 (file)
@@ -379,6 +379,9 @@ static bool IVUseShouldUsePostIncValue(Instruction *User, Instruction *IV,
   for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
     if (PN->getIncomingValue(i) == IV) {
       SplitCriticalEdge(PN->getIncomingBlock(i), PN->getParent(), P);
+      // Splitting the critical edge can reduce the number of entries in this
+      // PHI.
+      e = PN->getNumIncomingValues();
       if (--NumUses == 0) break;
     }
   
@@ -589,6 +592,9 @@ void BasedUser::RewriteInstructionToUseNewBase(const SCEVHandle &NewBase,
           BasicBlock *NewBB = PN->getIncomingBlock(i);
           NewBB->moveBefore(PN->getParent());
         }
+        
+        // Splitting the edge can reduce the number of PHI entries we have.
+        e = PN->getNumIncomingValues();
       }
 
       Value *&Code = InsertedCode[PN->getIncomingBlock(i)];