Get rid the of set membership test (log(m)) and, instead, use an index variable 'i'

which advances when src collides with a purged slot.
Hi Stephen, you're welcome to overwrite/or improve upon this version.  Thanks.

llvm-svn: 129611
This commit is contained in:
Johnny Chen 2011-04-15 21:45:12 +00:00
parent 9c65e4d69c
commit b57edcab3b
1 changed files with 4 additions and 3 deletions

View File

@ -320,12 +320,13 @@ DWARFDebugAranges::Sort()
return;
// Remove the merged ranges by shifting down all the keepers...
std::set<size_t> purged(indices.begin(), indices.end());
size_t new_size = m_aranges.size() - indices.size();
for (size_t src = 0, dst = 0; dst < new_size; ++src, ++dst)
for (size_t i = 0, src = 0, dst = 0; dst < new_size; ++src, ++dst)
{
while (purged.count(src) > 0)
while (src == indices[i]) {
++src;
++i;
}
if (src == dst)
continue;
m_aranges[dst] = m_aranges[src];