diff --git a/cranelift/codegen/src/context.rs b/cranelift/codegen/src/context.rs index 81b9dcbd23..842a48ab21 100644 --- a/cranelift/codegen/src/context.rs +++ b/cranelift/codegen/src/context.rs @@ -457,10 +457,8 @@ impl Context { #[cfg(feature = "souper-harvest")] pub fn souper_harvest( &mut self, - isa: &dyn TargetIsa, out: &mut std::sync::mpsc::Sender, ) -> CodegenResult<()> { - self.preopt(isa)?; do_souper_harvest(&self.func, out); Ok(()) } diff --git a/cranelift/src/souper_harvest.rs b/cranelift/src/souper_harvest.rs index 4167611b72..6c15547ae1 100644 --- a/cranelift/src/souper_harvest.rs +++ b/cranelift/src/souper_harvest.rs @@ -71,7 +71,11 @@ pub fn run(target: &str, input: &str, output: &str, flag_set: &[String]) -> Resu let mut ctx = Context::new(); ctx.func = func; - ctx.souper_harvest(fisa.isa.unwrap(), send) + ctx.compute_cfg(); + ctx.preopt(fisa.isa.unwrap()) + .map_err(|e| format!("failed to run preopt: {}", e))?; + + ctx.souper_harvest(send) .map_err(|e| format!("failed to run souper harvester: {}", e))?; Ok(())