vyre 0.4.0

GPU compute intermediate representation with a standard operation library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use super::{eliminate_dead_lets, eliminate_unreachable};
use crate::ir::Program;
use std::collections::HashSet;

/// Remove unreachable statements and unused pure `let` bindings.
#[must_use]
#[inline]
pub fn dce(program: Program) -> Program {
    let entry = eliminate_dead_lets(program.entry(), HashSet::new()).nodes;
    let entry = eliminate_unreachable(entry);
    let entry = eliminate_dead_lets(&entry, HashSet::new()).nodes;
    Program::new(program.buffers().to_vec(), program.workgroup_size(), entry)
        .with_optional_entry_op_id(program.entry_op_id().map(str::to_string))
}