projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
79b319d
)
Simplify potentially quadratic behavior while erasing elements from std::vector.
author
Jakub Staszak
<kubastaszak@gmail.com>
Tue, 16 Oct 2012 19:32:31 +0000
(19:32 +0000)
committer
Jakub Staszak
<kubastaszak@gmail.com>
Tue, 16 Oct 2012 19:32:31 +0000
(19:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166045
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Transforms/Scalar/DCE.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Scalar/DCE.cpp
b/lib/Transforms/Scalar/DCE.cpp
index 086f0a1a714bad1f94c3665fe88800feba806eb8..8d53443b389500957cdab746c661d478dfc505ee 100644
(file)
--- a/
lib/Transforms/Scalar/DCE.cpp
+++ b/
lib/Transforms/Scalar/DCE.cpp
@@
-118,13
+118,7
@@
bool DCE::runOnFunction(Function &F) {
I->eraseFromParent();
// Remove the instruction from the worklist if it still exists in it.
- for (std::vector<Instruction*>::iterator WI = WorkList.begin();
- WI != WorkList.end(); ) {
- if (*WI == I)
- WI = WorkList.erase(WI);
- else
- ++WI;
- }
+ WorkList.erase(std::remove(WorkList.begin(), WorkList.end(), I), WorkList.end());
MadeChange = true;
++DCEEliminated;