Use do+while instead of while for loops which obviously have a
non-zero trip count. Use SmallVector's pop_back_val().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92734 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index 27d9a06..30fe802 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/lib/Transforms/Utils/Local.cpp
@@ -278,7 +278,7 @@
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 @@
}
I->eraseFromParent();
- }
+ } while (!DeadInsts.empty());
return true;
}