pub fn apply(expr: &mut Expr) {
        let mut cse = Cse {
            sym_gen: SymbolGenerator::from_expression(expr),
            counter: 0,
        };

        // Maps expressions to symbol names.
        let bindings = &mut HashMap::new();

        cse.remove_common_subexpressions(expr, bindings);

        // Convert the bindings map from Expr -> Symbol to Symbol -> Expr.
        let bindings = &mut bindings
            .drain()
            .map(|(k, v)| (v, k))
            .collect::<HashMap<Symbol, Expr>>();

        cse.counter = 0;
        let sites = &mut cse.build_site_map(expr, bindings);
        let generated = &mut HashSet::new();
        let stack = &mut vec![];

        cse.counter = 0;
        cse.generate_bindings(expr, bindings, generated, &mut Site::new(), stack, sites);
    }
Apply the CSE transformation on the given expression.
weld/src/optimizer/transforms/cse.rs