I had a senior moment.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 5 Jun 2007 07:05:25 +0000 (07:05 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 5 Jun 2007 07:05:25 +0000 (07:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37433 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/IfConversion.cpp

index 1023f8fd95064fb7b5bcaf8ce3eac91a7c42edd1..c0c6b383e6c233112a83234ffe834e7285b29c2c 100644 (file)
@@ -444,10 +444,11 @@ bool IfConverter::AnalyzeBlocks(MachineFunction &MF,
 /// isNextBlock - Returns true either if ToBB the next block after BB or
 /// that all the intervening blocks are empty.
 static bool isNextBlock(MachineBasicBlock *BB, MachineBasicBlock *ToBB) {
-  MachineFunction *MF = BB->getParent();
   MachineFunction::iterator I = BB;
-  while (++I != MF->end() && I != MachineFunction::iterator(ToBB))
-    if (!I->empty())
+  MachineFunction::iterator TI = ToBB;
+  MachineFunction::iterator E = BB->getParent()->end();
+  while (++I != TI)
+    if (I == E || !I->empty())
       return false;
   return true;
 }