Use do+while instead of while for loops which obviously have a
[oota-llvm.git] / lib / Transforms / Utils / Local.cpp
index 27d9a06bfc688a81133f82a6a6fe87168849266d..30fe8025135092f437c258089f31d9d31448349d 100644 (file)
@@ -278,7 +278,7 @@ bool llvm::RecursivelyDeleteTriviallyDeadInstructions(Value *V) {
   SmallVector<Instruction*, 16> DeadInsts;
   DeadInsts.push_back(I);
   
-  while (!DeadInsts.empty()) {
+  do {
     I = DeadInsts.pop_back_val();
 
     // Null out all of the instruction's operands to see if any operand becomes
@@ -298,7 +298,7 @@ bool llvm::RecursivelyDeleteTriviallyDeadInstructions(Value *V) {
     }
     
     I->eraseFromParent();
-  }
+  } while (!DeadInsts.empty());
 
   return true;
 }