1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Zink compiler utils
#![cfg(feature = "utils")]

use std::path::Path;

/// Run wasm-opt on the given WASM file.
pub fn wasm_opt(input: impl AsRef<Path>, output: impl AsRef<Path>) -> anyhow::Result<()> {
    ::wasm_opt::OptimizationOptions::new_opt_level_4()
        .shrink_level(::wasm_opt::ShrinkLevel::Level2)
        .debug_info(false)
        .mvp_features_only()
        .set_converge()
        .run(&input, &output)
        .map_err(Into::into)
}