Use a bforest::Set to represent CFG successor sets.

This has two advantages over the previous Vec<Ebb>:

- Duplicates are removed.
- Clearing the control flow graph is constant time.

The set of EBB successors is simply ordered by EBB number.
This commit is contained in:
Jakob Stoklund Olesen
2017-11-20 14:02:16 -08:00
parent cf45afa1e7
commit b5d4fb66d9
3 changed files with 40 additions and 42 deletions

View File

@@ -916,8 +916,8 @@ impl<'a> Verifier<'a> {
let mut got_preds = BTreeSet::<Inst>::new();
for ebb in self.func.layout.ebbs() {
expected_succs.extend(self.expected_cfg.get_successors(ebb));
got_succs.extend(cfg.get_successors(ebb));
expected_succs.extend(self.expected_cfg.succ_iter(ebb));
got_succs.extend(cfg.succ_iter(ebb));
let missing_succs: Vec<Ebb> = expected_succs.difference(&got_succs).cloned().collect();
if !missing_succs.is_empty() {