Skip to main content

natural_loops

Function natural_loops 

Source
pub fn natural_loops(cfg: &Cfg, root: usize) -> Vec<NaturalLoop>
Expand description

The natural loops of cfg reachable from root, one per header (loops that share a header are merged), outermost first.

A back edge is an edge to a block on the depth-first search stack. In a reducible graph, which is what structured code (Rust without goto) compiles to, these are exactly the edges to a dominator, so this finds the same loops as dominator analysis.