diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-02-28 20:14:27 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-02-28 20:14:27 +0000 |
commit | 4c5dcb0a830366c36a715850eaafe7eb10d75a13 (patch) | |
tree | 9965d1ae5158efbab27d062601cffe7323282b3d /llvm/lib/CodeGen/LiveInterval.cpp | |
parent | 79a8c4b0cd0bd96b3ade9bb86aacb2811ca071cc (diff) | |
download | bcm5719-llvm-4c5dcb0a830366c36a715850eaafe7eb10d75a13.tar.gz bcm5719-llvm-4c5dcb0a830366c36a715850eaafe7eb10d75a13.zip |
LiveRange: Replace a creative vector erase loop with std::remove_if.
I didn't see this so far because it scans backwards, but that doesn't
make it any less quadratic. NFC.
llvm-svn: 230863
Diffstat (limited to 'llvm/lib/CodeGen/LiveInterval.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveInterval.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index fd7516dfd47..d60b0b1a504 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -567,13 +567,9 @@ void LiveRange::removeSegment(SlotIndex Start, SlotIndex End, /// Also remove the value# from value# list. void LiveRange::removeValNo(VNInfo *ValNo) { if (empty()) return; - iterator I = end(); - iterator E = begin(); - do { - --I; - if (I->valno == ValNo) - segments.erase(I); - } while (I != E); + segments.erase(std::remove_if(begin(), end(), [ValNo](const Segment &S) { + return S.valno == ValNo; + }), end()); // Now that ValNo is dead, remove it. markValNoForDeletion(ValNo); } |