aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/InstCombine/InstructionCombining.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-01-05 16:27:25 +0000
committerDan Gohman <gohman@apple.com>2010-01-05 16:27:25 +0000
commit321a813c536e2f1f2f05bbe78a7fbf64046f0557 (patch)
tree550286e12d0329b7e1ab4b88483a741672bd9515 /lib/Transforms/InstCombine/InstructionCombining.cpp
parentb7a9f2b5042589db89e521a4f86fd2fd70845e0f (diff)
downloadexternal_llvm-321a813c536e2f1f2f05bbe78a7fbf64046f0557.tar.gz
external_llvm-321a813c536e2f1f2f05bbe78a7fbf64046f0557.tar.bz2
external_llvm-321a813c536e2f1f2f05bbe78a7fbf64046f0557.zip
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
Diffstat (limited to 'lib/Transforms/InstCombine/InstructionCombining.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstructionCombining.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp
index 218e7ae229..8e59c01da8 100644
--- a/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1000,9 +1000,8 @@ static bool AddReachableCodeToWorklist(BasicBlock *BB,
SmallPtrSet<ConstantExpr*, 64> FoldedConstants;
- while (!Worklist.empty()) {
- BB = Worklist.back();
- Worklist.pop_back();
+ do {
+ BB = Worklist.pop_back_val();
// We have now visited this block! If we've already been here, ignore it.
if (!Visited.insert(BB)) continue;
@@ -1082,7 +1081,7 @@ static bool AddReachableCodeToWorklist(BasicBlock *BB,
for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
Worklist.push_back(TI->getSuccessor(i));
- }
+ } while (!Worklist.empty());
// Once we've found all of the instructions to add to instcombine's worklist,
// add them in reverse order. This way instcombine will visit from the top