mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
Simplify potentially quadratic behavior while erasing elements from std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166045 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
79b319d355
commit
761fbec9c2
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user