Delete old cranelift-preopt crate (#5642)
Most of these optimizations are in the egraph `cprop.isle` rules now, making a separate crate unnecessary. Also I think the `udiv` optimizations here are straight-up wrong (doing signed instead of unsigned division, and panicking instead of preserving traps on division by zero) so I'm guessing this crate isn't seriously used anywhere. At the least, bjorn3 confirms that cg_clif doesn't use this, and I've verified that Wasmtime doesn't either. Closes #1090.
This commit is contained in:
@@ -45,7 +45,6 @@ mod test_interpret;
|
||||
mod test_legalizer;
|
||||
mod test_licm;
|
||||
mod test_optimize;
|
||||
mod test_preopt;
|
||||
mod test_print_cfg;
|
||||
mod test_run;
|
||||
mod test_safepoint;
|
||||
@@ -122,7 +121,6 @@ fn new_subtest(parsed: &TestCommand) -> anyhow::Result<Box<dyn subtest::SubTest>
|
||||
"legalizer" => test_legalizer::subtest(parsed),
|
||||
"licm" => test_licm::subtest(parsed),
|
||||
"optimize" => test_optimize::subtest(parsed),
|
||||
"preopt" => test_preopt::subtest(parsed),
|
||||
"print-cfg" => test_print_cfg::subtest(parsed),
|
||||
"run" => test_run::subtest(parsed),
|
||||
"safepoint" => test_safepoint::subtest(parsed),
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
//! Test command for testing the constant folding pass.
|
||||
//!
|
||||
//! The `dce` test command runs each function through the constant folding pass after ensuring
|
||||
//! that all instructions are legal for the target.
|
||||
//!
|
||||
//! The resulting function is sent to `filecheck`.
|
||||
|
||||
use crate::subtest::{run_filecheck, Context, SubTest};
|
||||
use cranelift_codegen;
|
||||
use cranelift_codegen::ir::Function;
|
||||
use cranelift_preopt::optimize;
|
||||
use cranelift_reader::TestCommand;
|
||||
use std::borrow::Cow;
|
||||
|
||||
struct TestPreopt;
|
||||
|
||||
pub fn subtest(parsed: &TestCommand) -> anyhow::Result<Box<dyn SubTest>> {
|
||||
assert_eq!(parsed.command, "preopt");
|
||||
if !parsed.options.is_empty() {
|
||||
anyhow::bail!("No options allowed on {}", parsed);
|
||||
}
|
||||
Ok(Box::new(TestPreopt))
|
||||
}
|
||||
|
||||
impl SubTest for TestPreopt {
|
||||
fn name(&self) -> &'static str {
|
||||
"preopt"
|
||||
}
|
||||
|
||||
fn is_mutating(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn needs_isa(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn run(&self, func: Cow<Function>, context: &Context) -> anyhow::Result<()> {
|
||||
let isa = context.isa.expect("compile needs an ISA");
|
||||
let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
|
||||
|
||||
optimize(&mut comp_ctx, isa)
|
||||
.map_err(|e| crate::pretty_anyhow_error(&comp_ctx.func, Into::into(e)))?;
|
||||
|
||||
let text = comp_ctx.func.display().to_string();
|
||||
run_filecheck(&text, context)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user