summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Staszak <kubastaszak@gmail.com>2012-10-16 19:52:32 +0000
committerJakub Staszak <kubastaszak@gmail.com>2012-10-16 19:52:32 +0000
commitbe6f884afc019b54f6185064cd2daa45c5c73c57 (patch)
tree3849a6f029505be92e36aee09ff13c3f9588a454
parentb21d9aebba7e45ddcbce61dd501000049cefb335 (diff)
Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166053 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index 15b168fe2aa..047b43eb84f 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -907,13 +907,9 @@ void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val,
/// specified.
static void RemoveFromWorklist(Instruction *I,
std::vector<Instruction*> &Worklist) {
- std::vector<Instruction*>::iterator WI = std::find(Worklist.begin(),
- Worklist.end(), I);
- while (WI != Worklist.end()) {
- unsigned Offset = WI-Worklist.begin();
- Worklist.erase(WI);
- WI = std::find(Worklist.begin()+Offset, Worklist.end(), I);
- }
+
+ Worklist.erase(std::remove(Worklist.begin(), Worklist.end(), I),
+ Worklist.end());
}
/// ReplaceUsesOfWith - When we find that I really equals V, remove I from the