[ScopInfo] Actually remove from list.

std::remove, despite its name, does not remove elements from a list, but
only moves them to the end of a list.  Call erase() to shorten the
vector to the remaining elements.

Test case included in next commit.

llvm-svn: 329639
This commit is contained in:
Michael Kruse 2018-04-09 23:13:01 +00:00
parent 0034e393d9
commit 7de61668ae
1 changed files with 4 additions and 2 deletions

View File

@ -4856,13 +4856,15 @@ void Scop::removeAccessData(MemoryAccess *Access) {
ValueDefAccs.erase(Access->getAccessValue());
} else if (Access->isOriginalValueKind() && Access->isRead()) {
auto &Uses = ValueUseAccs[Access->getScopArrayInfo()];
std::remove(Uses.begin(), Uses.end(), Access);
auto NewEnd = std::remove(Uses.begin(), Uses.end(), Access);
Uses.erase(NewEnd, Uses.end());
} else if (Access->isOriginalPHIKind() && Access->isRead()) {
PHINode *PHI = cast<PHINode>(Access->getAccessInstruction());
PHIReadAccs.erase(PHI);
} else if (Access->isOriginalAnyPHIKind() && Access->isWrite()) {
auto &Incomings = PHIIncomingAccs[Access->getScopArrayInfo()];
std::remove(Incomings.begin(), Incomings.end(), Access);
auto NewEnd = std::remove(Incomings.begin(), Incomings.end(), Access);
Incomings.erase(NewEnd, Incomings.end());
}
}