diff --git a/lib/runtime-core/src/codegen.rs b/lib/runtime-core/src/codegen.rs index c687302f2..b89c060f5 100644 --- a/lib/runtime-core/src/codegen.rs +++ b/lib/runtime-core/src/codegen.rs @@ -156,9 +156,8 @@ impl< compiler_config: CompilerConfig, _: Token, ) -> CompileResult { - let res = validate(wasm); - if let Err(e) = res { - return Err(e); + if requires_pre_validation(MCG::backend_id()) { + validate(wasm)?; } let mut mcg = MCG::new(); @@ -191,6 +190,14 @@ impl< } } +fn requires_pre_validation(backend: Backend) -> bool { + match backend { + Backend::Cranelift => true, + Backend::LLVM => false, + Backend::Singlepass => false, + } +} + pub struct EventSink<'a, 'b> { buffer: SmallVec<[Event<'a, 'b>; 2]>, }