Use a do-while loop instead of while + boolean.

llvm-svn: 92912
This commit is contained in:
Benjamin Kramer 2010-01-07 13:50:07 +00:00
parent 950d5b2cd3
commit 76e2766442
1 changed files with 4 additions and 6 deletions

View File

@ -124,10 +124,9 @@ bool JumpThreading::runOnFunction(Function &F) {
FindLoopHeaders(F); FindLoopHeaders(F);
bool AnotherIteration = true, EverChanged = false; bool Changed, EverChanged = false;
while (AnotherIteration) { do {
AnotherIteration = false; Changed = false;
bool Changed = false;
for (Function::iterator I = F.begin(), E = F.end(); I != E;) { for (Function::iterator I = F.begin(), E = F.end(); I != E;) {
BasicBlock *BB = I; BasicBlock *BB = I;
// Thread all of the branches we can over this block. // Thread all of the branches we can over this block.
@ -176,9 +175,8 @@ bool JumpThreading::runOnFunction(Function &F) {
} }
} }
} }
AnotherIteration = Changed;
EverChanged |= Changed; EverChanged |= Changed;
} } while (Changed);
LoopHeaders.clear(); LoopHeaders.clear();
return EverChanged; return EverChanged;