Skip non-branching blocks now that we're using basic blocks

This is a rebase of [1]. In the long term, we'll want to simplify these
analysis passes. For now, this is simple and will reduce the number of
instructions processed in certain cases.

[1] https://github.com/bytecodealliance/cranelift/pull/866
This commit is contained in:
Ryan Hunt
2020-03-03 13:34:04 -06:00
committed by Benjamin Bouvier
parent 135a48ca7e
commit 4aa8776a9b
4 changed files with 21 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ impl<'a> CFGPrinter<'a> {
write!(w, " {} [shape=record, label=\"{{", block)?;
crate::write::write_block_header(w, self.func, None, block, 4)?;
// Add all outgoing branch instructions to the label.
for inst in self.func.layout.block_insts(block) {
for inst in self.func.layout.block_likely_branches(block) {
write!(w, " | <{}>", inst)?;
PlainWriter.write_instruction(w, self.func, &aliases, None, inst, 0)?;
}