Use do+while instead of while for loops which obviously have a
[oota-llvm.git] / lib / Transforms / Scalar / DeadStoreElimination.cpp
index f84735d0a12a22107da695c57f81af59735b7312..320afa19d5fbc30c3728c7253206e7c15f09a6ee 100644 (file)
@@ -523,9 +523,8 @@ void DSE::DeleteDeadInstruction(Instruction *I,
 
   // Before we touch this instruction, remove it from memdep!
   MemoryDependenceAnalysis &MDA = getAnalysis<MemoryDependenceAnalysis>();
-  while (!NowDeadInsts.empty()) {
-    Instruction *DeadInst = NowDeadInsts.back();
-    NowDeadInsts.pop_back();
+  do {
+    Instruction *DeadInst = NowDeadInsts.pop_back_val();
     
     ++NumFastOther;
     
@@ -549,7 +548,7 @@ void DSE::DeleteDeadInstruction(Instruction *I,
     DeadInst->eraseFromParent();
     
     if (ValueSet) ValueSet->erase(DeadInst);
-  }
+  } while (!NowDeadInsts.empty());
 }
 
 unsigned DSE::getPointerSize(Value *V) const {