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
This commit is contained in:
Dan Gohman
2010-01-05 16:27:25 +00:00
parent b7a9f2b504
commit 321a813c53
12 changed files with 23 additions and 29 deletions
+3 -4
View File
@@ -99,9 +99,8 @@ static bool MarkAliveBlocks(BasicBlock *BB,
SmallVector<BasicBlock*, 128> Worklist;
Worklist.push_back(BB);
bool Changed = false;
while (!Worklist.empty()) {
BB = Worklist.back();
Worklist.pop_back();
do {
BB = Worklist.pop_back_val();
if (!Reachable.insert(BB))
continue;
@@ -150,7 +149,7 @@ static bool MarkAliveBlocks(BasicBlock *BB,
Changed |= ConstantFoldTerminator(BB);
for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
Worklist.push_back(*SI);
}
} while (!Worklist.empty());
return Changed;
}