fn compute_non_local_scalars(cfg: &il::ControlFlowGraph) -> HashSet<il::Scalar> {
    let mut non_locals = HashSet::new();

    for block in cfg.blocks() {
        let mut killed = HashSet::new();

        block.instructions().iter().for_each(|inst| {
            inst.scalars_read()
                .unwrap_or_default()
                .into_iter()
                .filter(|scalar| !killed.contains(scalar))
                .for_each(|scalar| {
                    non_locals.insert(scalar.clone());
                });

            inst.scalars_written()
                .unwrap_or_default()
                .into_iter()
                .for_each(|scalar| {
                    killed.insert(scalar);
                });
        });
    }

    non_locals
}
// Computes the set of scalars that are live on entry of at least one block.
// Such scalars are denoted as "non locals" in the algorithm for Semi-Pruned SSA.
Computes the set of scalars that are live on entry of at least one block.
Such scalars are denoted as "non locals" in the algorithm for Semi-Pruned SSA.
Computes the set of scalars that are live on entry of at least one block . Such scalars are denoted as " non locals " in the algorithm for Semi - Pruned SSA .
fn compute_non_local_scalars(cfg: &il::ControlFlowGraph) -> HashSet<il::Scalar> {
    let mut non_locals = HashSet::new();
    for block in cfg.blocks() {
        let mut killed = HashSet::new();
        block.instructions().iter().for_each(|inst| {
            inst.scalars_read()
                .unwrap_or_default()
                .into_iter()
                .filter(|scalar| !killed.contains(scalar))
                .for_each(|scalar| {
                    non_locals.insert(scalar.clone());
                });
            inst.scalars_written()
                .unwrap_or_default()
                .into_iter()
                .for_each(|scalar| {
                    killed.insert(scalar);
                });
        });
    }
    non_locals
}
fn compute_non_local_scalars ( cfg : & il :: ControlFlowGraph ) -> HashSet < il :: Scalar > { let mut non_locals = HashSet :: new ( ) ; for block in cfg . blocks ( ) { let mut killed = HashSet :: new ( ) ; block . instructions ( ) . iter ( ) . for_each ( | inst | { inst . scalars_read ( ) . unwrap_or_default ( ) . into_iter ( ) . filter ( | scalar | ! killed . contains ( scalar ) ) . for_each ( | scalar | { non_locals . insert ( scalar . clone ( ) ) ; } ) ; inst . scalars_written ( ) . unwrap_or_default ( ) . into_iter ( ) . for_each ( | scalar | { killed . insert ( scalar ) ; } ) ; } ) ; } non_locals }
Computes the set of scalars that are live on entry of at least one block.
Computes the set of scalars that are live on entry of at least one block .
cfg
&il::ControlFlowGraph
cfg
&il::ControlFlowGraph