mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
CastleProto: track next top explicitly
Repeats may be removed (e.g. by pruning in role aliasing passes) leaving "holes" in the top map. Track the next top to use explicitly, rather than using repeats.size().
This commit is contained in:
committed by
Matthew Barr
parent
8427d83780
commit
748d46c124
@@ -751,14 +751,17 @@ void pruneReportIfUnused(const RoseBuildImpl &tbi, shared_ptr<NGHolder> h,
|
||||
* Castle. */
|
||||
static
|
||||
void pruneCastle(CastleProto &castle, ReportID report) {
|
||||
for (map<u32, PureRepeat>::iterator it = castle.repeats.begin();
|
||||
it != castle.repeats.end(); /* incr inside */) {
|
||||
if (contains(it->second.reports, report)) {
|
||||
++it;
|
||||
} else {
|
||||
castle.repeats.erase(it++);
|
||||
unordered_set<u32> dead; // tops to remove.
|
||||
for (const auto &m : castle.repeats) {
|
||||
if (!contains(m.second.reports, report)) {
|
||||
dead.insert(m.first);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &top : dead) {
|
||||
castle.erase(top);
|
||||
}
|
||||
|
||||
assert(!castle.repeats.empty());
|
||||
}
|
||||
|
||||
@@ -798,7 +801,7 @@ void pruneUnusedTops(CastleProto &castle, const RoseGraph &g,
|
||||
for (u32 top : assoc_keys(castle.repeats)) {
|
||||
if (!contains(used_tops, top)) {
|
||||
DEBUG_PRINTF("removing unused top %u\n", top);
|
||||
castle.repeats.erase(top);
|
||||
castle.erase(top);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user