[−][src]Function c2rust_transpile::cfg::loops::heuristic_loop_body
pub fn heuristic_loop_body(
predecessor_map: &IndexMap<Label, IndexSet<Label>>,
body_blocks: &mut IndexMap<Label, BasicBlock<StructureLabel<StmtOrDecl>, StmtOrDecl>>,
follow_blocks: &mut IndexMap<Label, BasicBlock<StructureLabel<StmtOrDecl>, StmtOrDecl>>,
follow_entries: &mut IndexSet<Label>
)
Use heuristics to decide which blocks to move into the loop body.
- Don't do anything if
follow_entries
is zero or one (since that means whatever follows the loop will be nice looking). - Otherwise, recursively push into the loop
follow_entries
as long as they have no more than 1 successor (the hope is that some of the chains will join).
This always succeeds.