mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
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
This commit is contained in:
parent
d89d4c9132
commit
9d5f68f7ad
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user