From 71c6d56c746ea4bdfe0283c5fc65d52ea60f91f0 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Mon, 22 Jun 2026 14:58:57 -0700 Subject: [PATCH] Translate Wasm block params into `Variable`s instead of CLIF block params This allows SSA construction to determine whether they need to actually become block params or not, and cuts down on the number of unnecessary block parameters we pessimistically introduce during Wasm-to-CLIF translation. --- .../stack_switching/instructions.rs | 20 +- .../src/translate/code_translator.rs | 240 ++++++++++++------ crates/cranelift/src/translate/stack.rs | 32 ++- .../src/translate/translation_utils.rs | 82 ++++-- .../disas/block-params-br_if-single-pred.wat | 61 +++++ .../block-params-if-else-same-values.wat | 56 ++++ .../block-params-loop-single-iteration.wat | 37 +++ tests/disas/br_table.wat | 32 +-- tests/disas/branch-hinting-disabled.wat | 12 +- tests/disas/branch-hinting.wat | 24 +- .../direct-adapter-calls-inlining.wat | 62 ++--- .../component-model/direct-adapter-calls.wat | 80 +++--- tests/disas/fac-multi-value.wat | 24 +- tests/disas/gc/copying/br-on-cast-fail.wat | 54 ++-- tests/disas/gc/copying/br-on-cast.wat | 54 ++-- tests/disas/gc/drc/br-on-cast-fail.wat | 54 ++-- tests/disas/gc/drc/br-on-cast.wat | 54 ++-- tests/disas/gc/null/br-on-cast-fail.wat | 54 ++-- tests/disas/gc/null/br-on-cast.wat | 54 ++-- tests/disas/if-unreachable-else-params-2.wat | 8 +- tests/disas/if-unreachable-else-params.wat | 10 +- tests/disas/multi-1.wat | 4 +- tests/disas/multi-10.wat | 12 +- tests/disas/multi-11.wat | 4 +- tests/disas/multi-13.wat | 8 +- tests/disas/multi-14.wat | 8 +- tests/disas/multi-16.wat | 16 +- tests/disas/multi-17.wat | 14 +- tests/disas/multi-3.wat | 6 +- tests/disas/multi-4.wat | 16 +- tests/disas/multi-6.wat | 2 +- tests/disas/multi-7.wat | 8 +- tests/disas/multi-8.wat | 12 +- tests/disas/multi-9.wat | 12 +- tests/disas/nullref.wat | 4 +- tests/disas/pr2303.wat | 56 ++-- tests/disas/simple.wat | 8 +- .../resume-suspend-data-passing.wat | 238 ++++++++--------- .../disas/stack-switching/resume-suspend.wat | 182 ++++++------- tests/disas/unreachable_code.wat | 6 +- 40 files changed, 1004 insertions(+), 716 deletions(-) create mode 100644 tests/disas/block-params-br_if-single-pred.wat create mode 100644 tests/disas/block-params-if-else-same-values.wat create mode 100644 tests/disas/block-params-loop-single-iteration.wat diff --git a/crates/cranelift/src/func_environ/stack_switching/instructions.rs b/crates/cranelift/src/func_environ/stack_switching/instructions.rs index f4b77a6e0c89..43884e509400 100644 --- a/crates/cranelift/src/func_environ/stack_switching/instructions.rs +++ b/crates/cranelift/src/func_environ/stack_switching/instructions.rs @@ -1,12 +1,13 @@ -use cranelift_codegen::ir::BlockArg; -use itertools::{Either, Itertools}; - +use crate::translate::set_block_params; use crate::trap::TranslateTrap; +use cranelift_codegen::ir::BlockArg; use cranelift_codegen::ir::condcodes::*; use cranelift_codegen::ir::types::*; use cranelift_codegen::ir::{self, MemFlagsData}; use cranelift_codegen::ir::{Block, BlockCall, InstBuilder, JumpTableData}; use cranelift_frontend::FunctionBuilder; +use itertools::{Either, Itertools}; +use smallvec::SmallVec; use wasmtime_environ::{PtrSize, TagIndex, TypeIndex, WasmResult, WasmValType, wasm_unsupported}; fn control_context_size(triple: &target_lexicon::Triple) -> WasmResult { @@ -1522,23 +1523,22 @@ pub(crate) fn translate_resume<'a>( .collect(); let values = suspended_contref.values(env, builder); - let mut suspend_args: Vec = values - .load_data_entries(env, builder, ¶m_types) - .into_iter() - .map(|v| BlockArg::Value(v)) - .collect(); + let mut suspend_args: Vec = + values.load_data_entries(env, builder, ¶m_types); // At the suspend site, we store the suspend args in the the // `values` buffer of the VMContRef that was active at the time that // the suspend instruction was performed. - suspend_args.push(BlockArg::Value(suspended_contobj)); + suspend_args.push(suspended_contobj); // We clear the suspend args. This is mostly for consistency. Note // that we don't zero out the data buffer, we still need it for the values.clear(env, builder, false); - builder.ins().jump(target_block, &suspend_args); + let mut tmp = SmallVec::new(); + let args = set_block_params(env, builder, &mut tmp, target_block, &suspend_args); + builder.ins().jump(target_block, args); } preamble_blocks diff --git a/crates/cranelift/src/translate/code_translator.rs b/crates/cranelift/src/translate/code_translator.rs index f62943cc5bd9..23b54fbd4592 100644 --- a/crates/cranelift/src/translate/code_translator.rs +++ b/crates/cranelift/src/translate/code_translator.rs @@ -78,15 +78,15 @@ use crate::translate::TargetEnvironment; use crate::translate::environ::StructFieldsVec; use crate::translate::stack::{ControlStackFrame, ElseData}; use crate::translate::translation_utils::{ - block_with_params, blocktype_params_results, f32_translation, f64_translation, + block_with_params, blocktype_params_results, f32_translation, f64_translation, set_block_params, }; use crate::trap::TranslateTrap; use cranelift_codegen::ir::condcodes::{FloatCC, IntCC}; use cranelift_codegen::ir::immediates::Offset32; use cranelift_codegen::ir::{ self, AtomicRmwOp, ExceptionTag, InstBuilder, JumpTableData, MemFlagsData, Value, ValueLabel, + types::*, }; -use cranelift_codegen::ir::{BlockArg, types::*}; use cranelift_codegen::packed_option::ReservedValue; use cranelift_frontend::{FunctionBuilder, Variable}; use itertools::Itertools; @@ -128,7 +128,7 @@ pub fn translate_operator( log::trace!("Translating Wasm opcode: {op:?}"); if !environ.is_reachable() { - translate_unreachable_operator(validator, &op, builder, environ)?; + translate_unreachable_operator(&op, builder, environ)?; return Ok(()); } @@ -269,20 +269,22 @@ pub fn translate_operator( let (params, results) = blocktype_params_results(validator, *blockty)?; let loop_body = block_with_params(builder, params.clone(), environ)?; let next = block_with_params(builder, results.clone(), environ)?; - canonicalise_then_jump(builder, loop_body, environ.stacks.peekn(params.len())); + canonicalise_then_jump( + environ, + builder, + loop_body, + environ.stacks.peekn(params.len()), + ); environ .stacks .push_loop(loop_body, next, params.len(), results.len()); - // Pop the initial `Block` actuals and replace them with the `Block`'s - // params since control flow joins at the top of the loop. + // Pop the initial `Block` actuals and replace them with the loop + // header's parameters since control flow joins at the top of the + // loop. environ.stacks.popn(params.len()); - environ - .stacks - .stack - .extend_from_slice(builder.block_params(loop_body)); - builder.switch_to_block(loop_body); + push_block_params(environ, builder, loop_body); environ.translate_loop_header(builder)?; } Operator::If { blockty } => { @@ -302,6 +304,7 @@ pub fn translate_operator( // and go back and patch the jump. let destination = block_with_params(builder, results.clone(), environ)?; let branch_inst = canonicalise_brif( + environ, builder, val, next_block, @@ -320,15 +323,8 @@ pub fn translate_operator( // The `if` type signature is not valid without an `else` block, // so we eagerly allocate the `else` block here. let destination = block_with_params(builder, results.clone(), environ)?; - let else_block = block_with_params(builder, params.clone(), environ)?; - canonicalise_brif( - builder, - val, - next_block, - &[], - else_block, - environ.stacks.peekn(params.len()), - ); + let else_block = builder.create_block(); + canonicalise_brif(environ, builder, val, next_block, &[], else_block, &[]); builder.seal_block(else_block); (destination, ElseData::WithElse { else_block }) }; @@ -402,9 +398,9 @@ pub fn translate_operator( let (params, _results) = blocktype_params_results(validator, blocktype)?; debug_assert_eq!(params.len(), num_return_values); - let else_block = - block_with_params(builder, params.clone(), environ)?; + let else_block = builder.create_block(); canonicalise_then_jump( + environ, builder, destination, environ.stacks.peekn(params.len()), @@ -421,6 +417,7 @@ pub fn translate_operator( } ElseData::WithElse { else_block } => { canonicalise_then_jump( + environ, builder, destination, environ.stacks.peekn(num_return_values), @@ -459,9 +456,13 @@ pub fn translate_operator( let frame = environ.stacks.control_stack.pop().unwrap(); let next_block = frame.following_code(); let return_count = frame.num_return_values(); - let return_args = environ.stacks.peekn_mut(return_count); - canonicalise_then_jump(builder, next_block, return_args); + canonicalise_then_jump( + environ, + builder, + next_block, + environ.stacks.peekn(return_count), + ); // You might expect that if we just finished an `if` block that // didn't have a corresponding `else` block, then we would clean // up our duplicate set of parameters that we pushed earlier @@ -483,10 +484,7 @@ pub fn translate_operator( &mut environ.stacks.stack, &mut environ.stacks.stack_shape, ); - environ - .stacks - .stack - .extend_from_slice(builder.block_params(next_block)); + push_block_params(environ, builder, next_block); } /**************************** Branch instructions ********************************* * The branch instructions all have as arguments a target nesting level, which @@ -522,8 +520,12 @@ pub fn translate_operator( }; (return_count, frame.br_destination()) }; - let destination_args = environ.stacks.peekn_mut(return_count); - canonicalise_then_jump(builder, br_destination, destination_args); + canonicalise_then_jump( + environ, + builder, + br_destination, + environ.stacks.peekn(return_count), + ); environ.stacks.popn(return_count); environ.stacks.reachable = false; } @@ -607,8 +609,12 @@ pub fn translate_operator( frame.set_branched_to_exit(); frame.br_destination() }; - let destination_args = environ.stacks.peekn_mut(return_count); - canonicalise_then_jump(builder, real_dest_block, destination_args); + canonicalise_then_jump( + environ, + builder, + real_dest_block, + environ.stacks.peekn(return_count), + ); } environ.stacks.popn(return_count); } @@ -2633,7 +2639,15 @@ pub fn translate_operator( let is_null = environ.translate_ref_is_null(builder.cursor(), r, r_ty)?; let (br_destination, inputs) = translate_br_if_args(*relative_depth, environ); let else_block = builder.create_block(); - canonicalise_brif(builder, is_null, br_destination, inputs, else_block, &[]); + canonicalise_brif( + environ, + builder, + is_null, + br_destination, + &inputs, + else_block, + &[], + ); builder.seal_block(else_block); // The only predecessor is the current block. builder.switch_to_block(else_block); @@ -2652,10 +2666,17 @@ pub fn translate_operator( }; let r_ty = *r_ty; let (br_destination, inputs) = translate_br_if_args(*relative_depth, environ); - let inputs = inputs.to_vec(); let is_null = environ.translate_ref_is_null(builder.cursor(), r, r_ty)?; let else_block = builder.create_block(); - canonicalise_brif(builder, is_null, else_block, &[], br_destination, &inputs); + canonicalise_brif( + environ, + builder, + is_null, + else_block, + &[], + br_destination, + &inputs, + ); // In the null case, pop the ref environ.stacks.pop1(); @@ -3040,10 +3061,11 @@ pub fn translate_operator( let (cast_succeeds_block, inputs) = translate_br_if_args(*relative_depth, environ); let cast_fails_block = builder.create_block(); canonicalise_brif( + environ, builder, cast_is_okay, cast_succeeds_block, - inputs, + &inputs, cast_fails_block, &[ // NB: the `cast_fails_block` is dominated by the current @@ -3074,6 +3096,7 @@ pub fn translate_operator( let (cast_fails_block, inputs) = translate_br_if_args(*relative_depth, environ); let cast_succeeds_block = builder.create_block(); canonicalise_brif( + environ, builder, cast_is_okay, cast_succeeds_block, @@ -3082,7 +3105,7 @@ pub fn translate_operator( // block, and therefore doesn't need any block params. ], cast_fails_block, - inputs, + &inputs, ); // The only predecessor is the current block. @@ -3347,7 +3370,6 @@ pub fn translate_operator( /// are dropped but special ones like `End` or `Else` signal the potential end of the unreachable /// portion so the translation state must be updated accordingly. fn translate_unreachable_operator( - validator: &FuncValidator, op: &Operator, builder: &mut FunctionBuilder, environ: &mut FuncEnvironment<'_>, @@ -3382,7 +3404,6 @@ fn translate_unreachable_operator( ref else_data, head_is_reachable, ref mut consequent_ends_reachable, - blocktype, .. } => { debug_assert!(consequent_ends_reachable.is_none()); @@ -3397,9 +3418,7 @@ fn translate_unreachable_operator( branch_inst, placeholder, } => { - let (params, _results) = - blocktype_params_results(validator, blocktype)?; - let else_block = block_with_params(builder, params, environ)?; + let else_block = builder.create_block(); let frame = environ.stacks.control_stack.last().unwrap(); frame.truncate_value_stack_to_else_params( &mut environ.stacks.stack, @@ -3437,15 +3456,15 @@ fn translate_unreachable_operator( } } Operator::End => { - let value_stack = &mut environ.stacks.stack; - let stack_shape = &mut environ.stacks.stack_shape; - let control_stack = &mut environ.stacks.control_stack; - let frame = control_stack.pop().unwrap(); + let frame = environ.stacks.control_stack.pop().unwrap(); frame.restore_catch_handlers(&mut environ.stacks.handlers, builder); // Pop unused parameters from stack. - frame.truncate_value_stack_to_original_size(value_stack, stack_shape); + frame.truncate_value_stack_to_original_size( + &mut environ.stacks.stack, + &mut environ.stacks.stack_shape, + ); let reachable_anyway = match frame { // If it is a loop we also have to seal the body loop block @@ -3477,12 +3496,13 @@ fn translate_unreachable_operator( }; if frame.exit_is_branched_to() || reachable_anyway { - builder.switch_to_block(frame.following_code()); - builder.seal_block(frame.following_code()); + let next_block = frame.following_code(); + builder.switch_to_block(next_block); + builder.seal_block(next_block); // And add the return values of the block but only if the next block is reachable // (which corresponds to testing if the stack depth is 1) - value_stack.extend_from_slice(builder.block_params(frame.following_code())); + push_block_params(environ, builder, next_block); environ.stacks.reachable = true; } } @@ -4028,16 +4048,16 @@ fn translate_br_if( }); } - canonicalise_brif(builder, val, br_destination, inputs, next_block, &[]); + canonicalise_brif(env, builder, val, br_destination, &inputs, next_block, &[]); builder.seal_block(next_block); // The only predecessor is the current block. builder.switch_to_block(next_block); } -fn translate_br_if_args<'a>( +fn translate_br_if_args( relative_depth: u32, - env: &'a mut FuncEnvironment<'_>, -) -> (ir::Block, &'a mut [ir::Value]) { + env: &mut FuncEnvironment<'_>, +) -> (ir::Block, SmallVec<[ir::Value; 8]>) { let i = env.stacks.control_stack.len() - 1 - (relative_depth as usize); let (return_count, br_destination) = { let frame = &mut env.stacks.control_stack[i]; @@ -4051,7 +4071,10 @@ fn translate_br_if_args<'a>( }; (return_count, frame.br_destination()) }; - let inputs = env.stacks.peekn_mut(return_count); + // Copy the branch arguments off the operand stack into an owned buffer so + // that callers can subsequently borrow `env` (e.g. to look up the + // destination's parameter variables) without conflicting with this borrow. + let inputs = env.stacks.peekn(return_count).to_smallvec(); (br_destination, inputs) } @@ -4303,12 +4326,20 @@ fn is_non_canonical_v128(ty: ir::Type) -> bool { /// actually necessary, and if not, the original slice is returned. Otherwise the cast values /// are returned in a slice that belongs to the caller-supplied `SmallVec`. fn canonicalise_v128_values<'a>( - tmp_canonicalised: &'a mut SmallVec<[BlockArg; 16]>, + tmp_canonicalised: &'a mut SmallVec<[ir::Value; 16]>, builder: &mut FunctionBuilder, values: &'a [ir::Value], -) -> &'a [BlockArg] { +) -> &'a [ir::Value] { debug_assert!(tmp_canonicalised.is_empty()); - // Cast, and push the resulting `Value`s into `canonicalised`. + // If no value needs canonicalising, we can avoid any work and return the + // original slice unchanged. + if values + .iter() + .all(|v| !is_non_canonical_v128(builder.func.dfg.value_type(*v))) + { + return values; + } + // Otherwise cast as necessary, and push the resulting `Value`s into `canonicalised`. for v in values { let value = if is_non_canonical_v128(builder.func.dfg.value_type(*v)) { let mut flags = MemFlagsData::new(); @@ -4317,26 +4348,62 @@ fn canonicalise_v128_values<'a>( } else { *v }; - tmp_canonicalised.push(BlockArg::from(value)); + tmp_canonicalised.push(value); } tmp_canonicalised.as_slice() } +/// Recover the Wasm stack parameters of `block` and push them onto the operand +/// stack as we begin translating that block. +/// +/// The caller must have already switched to `block`. +/// +/// For a Wasm control-flow target (i.e. a block with associated parameter +/// `Variable`s) we `use_var` each of those variables. For a block with real +/// CLIF block parameters (the function's exit block) we read those parameters +/// directly. +fn push_block_params( + environ: &mut FuncEnvironment<'_>, + builder: &mut FunctionBuilder, + block: ir::Block, +) { + debug_assert_eq!(builder.current_block(), Some(block)); + match environ.stacks.block_param_vars.get(&block) { + Some(vars) => { + let vars: SmallVec<[Variable; 6]> = vars.clone(); + for var in vars { + let val = builder.use_var(var); + environ.stacks.stack.push(val); + } + } + None => { + environ + .stacks + .stack + .extend_from_slice(builder.block_params(block)); + } + } +} + /// Generate a `jump` instruction, but first cast all 128-bit vector values to I8X16 if they /// don't have that type. This is done in somewhat roundabout way so as to ensure that we /// almost never have to do any heap allocation. fn canonicalise_then_jump( + environ: &FuncEnvironment<'_>, builder: &mut FunctionBuilder, destination: ir::Block, params: &[ir::Value], ) -> ir::Inst { - let mut tmp_canonicalised = SmallVec::<[_; 16]>::new(); - let canonicalised = canonicalise_v128_values(&mut tmp_canonicalised, builder, params); - builder.ins().jump(destination, canonicalised) + let mut canonicalised = SmallVec::<[_; 16]>::new(); + let canonicalised = canonicalise_v128_values(&mut canonicalised, builder, params); + let mut args = SmallVec::<[_; 16]>::new(); + let args = set_block_params(environ, builder, &mut args, destination, canonicalised); + builder.ins().jump(destination, args) } -/// The same but for a `brif` instruction. +/// The same as `canonicalise_then_jump` but for a `brif` instruction. fn canonicalise_brif( + environ: &FuncEnvironment<'_>, builder: &mut FunctionBuilder, cond: ir::Value, block_then: ir::Block, @@ -4344,19 +4411,33 @@ fn canonicalise_brif( block_else: ir::Block, params_else: &[ir::Value], ) -> ir::Inst { - let mut tmp_canonicalised_then = SmallVec::<[_; 16]>::new(); + let mut canonicalised_then = SmallVec::<[_; 16]>::new(); let canonicalised_then = - canonicalise_v128_values(&mut tmp_canonicalised_then, builder, params_then); - let mut tmp_canonicalised_else = SmallVec::<[_; 16]>::new(); - let canonicalised_else = - canonicalise_v128_values(&mut tmp_canonicalised_else, builder, params_else); - builder.ins().brif( - cond, + canonicalise_v128_values(&mut canonicalised_then, builder, params_then); + let mut args_then = SmallVec::<[_; 16]>::new(); + let args_then = set_block_params( + environ, + builder, + &mut args_then, block_then, canonicalised_then, + ); + + let mut canonicalised_else = SmallVec::<[_; 16]>::new(); + let canonicalised_else = + canonicalise_v128_values(&mut canonicalised_else, builder, params_else); + let mut args_else = SmallVec::<[_; 16]>::new(); + let args_else = set_block_params( + environ, + builder, + &mut args_else, block_else, canonicalised_else, - ) + ); + + builder + .ins() + .brif(cond, block_then, args_then, block_else, args_else) } /// A helper for popping and bitcasting a single value; since SIMD values can lose their type by @@ -4493,14 +4574,18 @@ fn create_catch_block( // are compiling a `*Ref` variant. let (exn_ref_ty, needs_stack_map) = environ.reference_type(WasmHeapType::Exn); - let (exn_payload_wasm_ty, exn_payload_ty) = match environ.pointer_type().bits() { - 32 => (wasmparser::ValType::I32, I32), - 64 => (wasmparser::ValType::I64, I64), + let exn_payload_ty = match environ.pointer_type().bits() { + 32 => I32, + 64 => I64, _ => panic!("Unsupported pointer width"), }; - let block = block_with_params(builder, [exn_payload_wasm_ty], environ)?; + // Unlike Wasm control-flow targets, a catch block's single parameter is a + // real CLIF block parameter: it is filled in by the exception ABI (the + // `try_call`'s exception table), not by an ordinary branch. So create it + // directly rather than going through `block_with_params`. + let block = builder.create_block(); + let exn_ref = builder.append_block_param(block, exn_payload_ty); builder.switch_to_block(block); - let exn_ref = builder.func.dfg.block_params(block)[0]; debug_assert!(exn_ref_ty.bits() <= exn_payload_ty.bits()); let exn_ref = if exn_ref_ty.bits() < exn_payload_ty.bits() { builder.ins().ireduce(exn_ref_ty, exn_ref) @@ -4535,7 +4620,8 @@ fn create_catch_block( let i = environ.stacks.control_stack.len() - 1 - (label as usize); let frame = &mut environ.stacks.control_stack[i]; frame.set_branched_to_exit(); - canonicalise_then_jump(builder, frame.br_destination(), ¶ms); + let br_destination = frame.br_destination(); + canonicalise_then_jump(environ, builder, br_destination, ¶ms); Ok(block) } diff --git a/crates/cranelift/src/translate/stack.rs b/crates/cranelift/src/translate/stack.rs index 95250df682f7..0e9db287a23a 100644 --- a/crates/cranelift/src/translate/stack.rs +++ b/crates/cranelift/src/translate/stack.rs @@ -5,7 +5,9 @@ //! a single function. use cranelift_codegen::ir::{self, Block, ExceptionTag, Inst, Value}; -use cranelift_frontend::FunctionBuilder; +use cranelift_frontend::{FunctionBuilder, Variable}; +use smallvec::SmallVec; +use std::collections::HashMap; use std::vec::Vec; use wasmtime_environ::FrameStackShape; @@ -267,6 +269,25 @@ pub struct FuncTranslationStacks { pub(crate) stack_shape: Vec, /// A stack of active control flow operations at this point in the input wasm function. pub(crate) control_stack: Vec, + /// Maps a CLIF block representing a Wasm control-flow target to the + /// `Variable`s that hold its Wasm stack parameters. + /// + /// Rather than giving these blocks CLIF block parameters and passing the + /// Wasm operand stack values as block arguments when branching to them, we + /// represent each Wasm stack parameter as a `Variable`. When branching to + /// such a block we `def_var` the variables and emit an argument-less + /// branch; when we begin translating the block we `use_var` each variable + /// and push the results onto the operand stack. This lets + /// `cranelift-frontend`'s SSA construction decide whether a real block + /// parameter is actually needed (i.e. only when multiple predecessors pass + /// differing values) instead of pessimistically creating one for every + /// Wasm block. + /// + /// Note that not every CLIF block is present in this map: the function's + /// exit block keeps real CLIF block parameters (for the function returns), + /// and various internal blocks (e.g. an `if`'s consequent, or the + /// fall-through after a `br_if`) have no parameters at all. + pub(crate) block_param_vars: HashMap>, /// Exception handler state, updated as we enter and exit /// `try_table` scopes and attached to each call that we make. pub(crate) handlers: HandlerState, @@ -291,6 +312,7 @@ impl FuncTranslationStacks { stack: Vec::new(), stack_shape: Vec::new(), control_stack: Vec::new(), + block_param_vars: HashMap::new(), handlers: HandlerState::default(), reachable: true, } @@ -301,6 +323,7 @@ impl FuncTranslationStacks { debug_assert!(self.stack_shape.is_empty()); debug_assert!(self.control_stack.is_empty()); debug_assert!(self.handlers.is_empty()); + self.block_param_vars.clear(); self.reachable = true; } @@ -432,13 +455,6 @@ impl FuncTranslationStacks { &self.stack[self.stack.len() - n..] } - /// Peek at the top `n` values on the stack in the order they were pushed. - pub(crate) fn peekn_mut(&mut self, n: usize) -> &mut [Value] { - self.ensure_length_is_at_least(n); - let len = self.stack.len(); - &mut self.stack[len - n..] - } - fn push_block_impl( &mut self, following_code: Block, diff --git a/crates/cranelift/src/translate/translation_utils.rs b/crates/cranelift/src/translate/translation_utils.rs index d7595911bab9..9742898d8b89 100644 --- a/crates/cranelift/src/translate/translation_utils.rs +++ b/crates/cranelift/src/translate/translation_utils.rs @@ -1,10 +1,12 @@ //! Helper functions and structures for the translation. +use crate::func_environ::FuncEnvironment; use crate::translate::environ::TargetEnvironment; use core::u32; use cranelift_codegen::ir; use cranelift_frontend::FunctionBuilder; +use smallvec::SmallVec; use wasmparser::{FuncValidator, WasmModuleResources}; -use wasmtime_environ::WasmResult; +use wasmtime_environ::{TypeConvert, WasmResult}; /// Get the parameter and result types for the given Wasm blocktype. pub fn blocktype_params_results<'a, T>( @@ -41,40 +43,70 @@ where }); } -/// Create a `Block` with the given Wasm parameters. -pub fn block_with_params( +/// Set up the Wasm stack parameters of `destination` to `values` ahead of an +/// argument-less branch to that block. +/// +/// If `destination` is a Wasm control-flow target (i.e. it has associated +/// parameter `Variable`s) then we `def_var` each of those variables and the +/// branch carries no block arguments. Otherwise `destination` has real CLIF +/// block parameters (e.g. the function exit block), so we return the values as +/// block arguments to pass directly. +pub fn set_block_params<'a>( + environ: &FuncEnvironment<'_>, + builder: &mut FunctionBuilder, + tmp: &'a mut SmallVec<[ir::BlockArg; 16]>, + destination: ir::Block, + values: &[ir::Value], +) -> &'a [ir::BlockArg] { + debug_assert!(tmp.is_empty()); + match environ.stacks.block_param_vars.get(&destination) { + Some(vars) => { + debug_assert_eq!(vars.len(), values.len()); + for (var, val) in vars.iter().zip(values) { + builder.def_var(*var, *val); + } + &[] + } + None => { + tmp.extend(values.iter().map(|v| ir::BlockArg::from(*v))); + tmp.as_slice() + } + } +} + +/// Create a `Block` representing a Wasm control-flow target with the given Wasm +/// stack parameters. +/// +/// Rather than giving the block CLIF block parameters, we create a +/// `cranelift_frontend::Variable` for each Wasm stack parameter and record the +/// block-to-variables mapping in `environ.stacks.block_param_vars`. See the +/// `block_param_vars` docs for more details. +pub fn block_with_params( builder: &mut FunctionBuilder, params: impl IntoIterator, - environ: &PE, + environ: &mut FuncEnvironment<'_>, ) -> WasmResult { let block = builder.create_block(); + let mut vars = SmallVec::<[_; 6]>::new(); for ty in params { - match ty { - wasmparser::ValType::I32 => { - builder.append_block_param(block, ir::types::I32); - } - wasmparser::ValType::I64 => { - builder.append_block_param(block, ir::types::I64); - } - wasmparser::ValType::F32 => { - builder.append_block_param(block, ir::types::F32); - } - wasmparser::ValType::F64 => { - builder.append_block_param(block, ir::types::F64); - } + let (clif_ty, needs_stack_map) = match ty { + wasmparser::ValType::I32 => (ir::types::I32, false), + wasmparser::ValType::I64 => (ir::types::I64, false), + wasmparser::ValType::F32 => (ir::types::F32, false), + wasmparser::ValType::F64 => (ir::types::F64, false), wasmparser::ValType::Ref(rt) => { let hty = environ.convert_heap_type(rt.heap_type())?; - let (ty, needs_stack_map) = environ.reference_type(hty); - let val = builder.append_block_param(block, ty); - if needs_stack_map { - builder.declare_value_needs_stack_map(val); - } - } - wasmparser::ValType::V128 => { - builder.append_block_param(block, ir::types::I8X16); + environ.reference_type(hty) } + wasmparser::ValType::V128 => (ir::types::I8X16, false), + }; + let var = builder.declare_var(clif_ty); + if needs_stack_map { + builder.declare_var_needs_stack_map(var); } + vars.push(var); } + environ.stacks.block_param_vars.insert(block, vars); Ok(block) } diff --git a/tests/disas/block-params-br_if-single-pred.wat b/tests/disas/block-params-br_if-single-pred.wat new file mode 100644 index 000000000000..27175747ed7a --- /dev/null +++ b/tests/disas/block-params-br_if-single-pred.wat @@ -0,0 +1,61 @@ +;;! target = "x86_64" + +;; A `br_if` to a block whose only reachable predecessor is that `br_if` (the +;; fall-through path ends in `unreachable`) does not need block parameters for +;; the branched-with values. + +(module + (import "" "f" (func $f (result i32))) + (import "" "g" (func $g (param i32 i32))) + (import "" "h" (func $h (param i32 i32))) + (func + block (result i32 i32) + i32.const 1 + i32.const 2 + call $f + br_if 0 + call $g + unreachable + end + call $h + ) +) +;; function u0:0(i64 vmctx, i64) tail { +;; region0 = 8 "VMContext+0x8" +;; region1 = 268435480 "VMStoreContext+0x18" +;; region2 = 72 "VMContext+0x48" +;; region3 = 56 "VMContext+0x38" +;; region4 = 104 "VMContext+0x68" +;; region5 = 88 "VMContext+0x58" +;; region6 = 136 "VMContext+0x88" +;; region7 = 120 "VMContext+0x78" +;; gv0 = vmctx +;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8 +;; gv2 = load.i64 notrap aligned region1 gv1+24 +;; sig0 = (i64 vmctx, i64) -> i32 tail +;; sig1 = (i64 vmctx, i64, i32, i32) tail +;; stack_limit = gv2 +;; +;; block0(v0: i64, v1: i64): +;; @0039 v2 = iconst.i32 1 +;; @003b v3 = iconst.i32 2 +;; @003d v4 = load.i64 notrap aligned readonly can_move region2 v0+72 +;; @003d v5 = load.i64 notrap aligned readonly can_move region3 v0+56 +;; @003d v6 = call_indirect sig0, v5(v4, v0) +;; @003f brif v6, block2, block3 +;; +;; block3: +;; @0041 v7 = load.i64 notrap aligned readonly can_move region4 v0+104 +;; @0041 v8 = load.i64 notrap aligned readonly can_move region5 v0+88 +;; @0041 call_indirect sig1, v8(v7, v0, v2, v3) ; v2 = 1, v3 = 2 +;; @0043 trap user12 +;; +;; block2: +;; @0045 v9 = load.i64 notrap aligned readonly can_move region6 v0+136 +;; @0045 v10 = load.i64 notrap aligned readonly can_move region7 v0+120 +;; @0045 call_indirect sig1, v10(v9, v0, v2, v3) ; v2 = 1, v3 = 2 +;; @0047 jump block1 +;; +;; block1: +;; @0047 return +;; } diff --git a/tests/disas/block-params-if-else-same-values.wat b/tests/disas/block-params-if-else-same-values.wat new file mode 100644 index 000000000000..922b55a62095 --- /dev/null +++ b/tests/disas/block-params-if-else-same-values.wat @@ -0,0 +1,56 @@ +;;! target = "x86_64" + +;; The control-flow join after an if/else diamond has two predecessors, but when +;; both the consequent and the alternative pass the same values, no block +;; parameter is needed. + +(module + (import "" "f" (func $f)) + (import "" "g" (func $g)) + (func (param i32 i32 i32) (result i32 i32) + local.get 0 + if (result i32 i32) + call $f + local.get 1 + local.get 2 + else + call $g + local.get 1 + local.get 2 + end + ) +) +;; function u0:0(i64 vmctx, i64, i32, i32, i32) -> i32, i32 tail { +;; region0 = 8 "VMContext+0x8" +;; region1 = 268435480 "VMStoreContext+0x18" +;; region2 = 72 "VMContext+0x48" +;; region3 = 56 "VMContext+0x38" +;; region4 = 104 "VMContext+0x68" +;; region5 = 88 "VMContext+0x58" +;; gv0 = vmctx +;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8 +;; gv2 = load.i64 notrap aligned region1 gv1+24 +;; sig0 = (i64 vmctx, i64) tail +;; stack_limit = gv2 +;; +;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32): +;; @0033 brif v2, block2, block4 +;; +;; block2: +;; @0035 v7 = load.i64 notrap aligned readonly can_move region2 v0+72 +;; @0035 v8 = load.i64 notrap aligned readonly can_move region3 v0+56 +;; @0035 call_indirect sig0, v8(v7, v0) +;; @003b jump block3 +;; +;; block4: +;; @003c v9 = load.i64 notrap aligned readonly can_move region4 v0+104 +;; @003c v10 = load.i64 notrap aligned readonly can_move region5 v0+88 +;; @003c call_indirect sig0, v10(v9, v0) +;; @0042 jump block3 +;; +;; block3: +;; @0043 jump block1 +;; +;; block1: +;; @0043 return v3, v4 +;; } diff --git a/tests/disas/block-params-loop-single-iteration.wat b/tests/disas/block-params-loop-single-iteration.wat new file mode 100644 index 000000000000..4d2a7e7cff2a --- /dev/null +++ b/tests/disas/block-params-loop-single-iteration.wat @@ -0,0 +1,37 @@ +;;! target = "x86_64" + +;; A `loop` that never branches back to the loop header only ever runs a single +;; iteration, so its header block has just one predecessor and should have no +;; block parameters. + +(module + (func (param i32) (result i32) + local.get 0 + (loop (param i32) (result i32) + i32.const 1 + i32.add + ) + ) +) +;; function u0:0(i64 vmctx, i64, i32) -> i32 tail { +;; region0 = 8 "VMContext+0x8" +;; region1 = 268435480 "VMStoreContext+0x18" +;; gv0 = vmctx +;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8 +;; gv2 = load.i64 notrap aligned region1 gv1+24 +;; stack_limit = gv2 +;; +;; block0(v0: i64, v1: i64, v2: i32): +;; @001b jump block2 +;; +;; block2: +;; @001d v5 = iconst.i32 1 +;; @001f v6 = iadd.i32 v2, v5 ; v5 = 1 +;; @0020 jump block3 +;; +;; block3: +;; @0021 jump block1 +;; +;; block1: +;; @0021 return v6 +;; } diff --git a/tests/disas/br_table.wat b/tests/disas/br_table.wat index 2aadd71d0e9b..861f1992f033 100644 --- a/tests/disas/br_table.wat +++ b/tests/disas/br_table.wat @@ -40,9 +40,9 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0021 v6 = iconst.i32 42 -;; @0023 v7 = iconst.i32 0 -;; @0025 br_table v7, block8, [block5, block6, block7] ; v7 = 0 +;; @0021 v3 = iconst.i32 42 +;; @0023 v4 = iconst.i32 0 +;; @0025 br_table v4, block8, [block5, block6, block7] ; v4 = 0 ;; ;; block5: ;; @0025 jump block4 @@ -66,7 +66,7 @@ ;; @002e jump block1 ;; ;; block1: -;; @002e return v6 ; v6 = 42 +;; @002e return v3 ; v3 = 42 ;; } ;; ;; function u0:1(i64 vmctx, i64) -> i32 tail { @@ -78,9 +78,9 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0037 v6 = iconst.i32 42 -;; @0039 v7 = iconst.i32 0 -;; @003b br_table v7, block8, [block5, block6, block7] ; v7 = 0 +;; @0037 v3 = iconst.i32 42 +;; @0039 v4 = iconst.i32 0 +;; @003b br_table v4, block8, [block5, block6, block7] ; v4 = 0 ;; ;; block5: ;; @003b jump block1 @@ -104,7 +104,7 @@ ;; @0044 jump block1 ;; ;; block1: -;; @0044 return v6 ; v6 = 42 +;; @0044 return v3 ; v3 = 42 ;; } ;; ;; function u0:2(i64 vmctx, i64) -> i32 tail { @@ -116,9 +116,9 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0049 v4 = iconst.i32 42 -;; @004b v5 = iconst.i32 0 -;; @004d br_table v5, block4, [block3, block3, block4] ; v5 = 0 +;; @0049 v3 = iconst.i32 42 +;; @004b v4 = iconst.i32 0 +;; @004d br_table v4, block4, [block3, block3, block4] ; v4 = 0 ;; ;; block3: ;; @004d jump block2 @@ -130,7 +130,7 @@ ;; @0054 jump block1 ;; ;; block1: -;; @0054 return v4 ; v4 = 42 +;; @0054 return v3 ; v3 = 42 ;; } ;; ;; function u0:3(i64 vmctx, i64) -> i32 tail { @@ -142,9 +142,9 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0059 v4 = iconst.i32 42 -;; @005b v5 = iconst.i32 0 -;; @005d br_table v5, block4, [block3, block3, block4] ; v5 = 0 +;; @0059 v3 = iconst.i32 42 +;; @005b v4 = iconst.i32 0 +;; @005d br_table v4, block4, [block3, block3, block4] ; v4 = 0 ;; ;; block3: ;; @005d jump block1 @@ -156,5 +156,5 @@ ;; @0064 jump block1 ;; ;; block1: -;; @0064 return v4 ; v4 = 42 +;; @0064 return v3 ; v3 = 42 ;; } diff --git a/tests/disas/branch-hinting-disabled.wat b/tests/disas/branch-hinting-disabled.wat index 4435a37bc017..f0e776e44474 100644 --- a/tests/disas/branch-hinting-disabled.wat +++ b/tests/disas/branch-hinting-disabled.wat @@ -39,15 +39,15 @@ ;; @0043 brif v2, block2, block4 ;; ;; block2: -;; @0045 v5 = iconst.i32 1 -;; @0047 jump block3(v5) ; v5 = 1 +;; @0045 v4 = iconst.i32 1 +;; @0047 jump block3(v4) ; v4 = 1 ;; ;; block4: -;; @0048 v6 = iconst.i32 2 -;; @004a jump block3(v6) ; v6 = 2 +;; @0048 v5 = iconst.i32 2 +;; @004a jump block3(v5) ; v5 = 2 ;; -;; block3(v4: i32): -;; @004b jump block1(v4) +;; block3(v6: i32): +;; @004b jump block1(v6) ;; ;; block1(v3: i32): ;; @004b return v3 diff --git a/tests/disas/branch-hinting.wat b/tests/disas/branch-hinting.wat index e92ad164460b..27ea41885bdf 100644 --- a/tests/disas/branch-hinting.wat +++ b/tests/disas/branch-hinting.wat @@ -130,15 +130,15 @@ ;; @007f brif v2, block2, block4 ;; ;; block2 cold: -;; @0081 v5 = iconst.i32 1 -;; @0083 jump block3(v5) ; v5 = 1 +;; @0081 v4 = iconst.i32 1 +;; @0083 jump block3(v4) ; v4 = 1 ;; ;; block4: -;; @0084 v6 = iconst.i32 2 -;; @0086 jump block3(v6) ; v6 = 2 +;; @0084 v5 = iconst.i32 2 +;; @0086 jump block3(v5) ; v5 = 2 ;; -;; block3(v4: i32): -;; @0087 jump block1(v4) +;; block3(v6: i32): +;; @0087 jump block1(v6) ;; ;; block1(v3: i32): ;; @0087 return v3 @@ -156,15 +156,15 @@ ;; @008c brif v2, block2, block4 ;; ;; block2: -;; @008e v5 = iconst.i32 1 -;; @0090 jump block3(v5) ; v5 = 1 +;; @008e v4 = iconst.i32 1 +;; @0090 jump block3(v4) ; v4 = 1 ;; ;; block4 cold: -;; @0091 v6 = iconst.i32 2 -;; @0093 jump block3(v6) ; v6 = 2 +;; @0091 v5 = iconst.i32 2 +;; @0093 jump block3(v5) ; v5 = 2 ;; -;; block3(v4: i32): -;; @0094 jump block1(v4) +;; block3(v6: i32): +;; @0094 jump block1(v6) ;; ;; block1(v3: i32): ;; @0094 return v3 diff --git a/tests/disas/component-model/direct-adapter-calls-inlining.wat b/tests/disas/component-model/direct-adapter-calls-inlining.wat index d990e66dc0dc..4462a073953c 100644 --- a/tests/disas/component-model/direct-adapter-calls-inlining.wat +++ b/tests/disas/component-model/direct-adapter-calls-inlining.wat @@ -85,37 +85,37 @@ ;; block2: ;; jump block6 ;; -;; block8(v9: i64): +;; block8(v7: i64): ;; jump block5 ;; ;; block6: ;; @00ee v4 = load.i64 notrap aligned readonly can_move region2 v0+72 -;; v14 = load.i64 notrap aligned readonly can_move region3 v4+136 -;; v15 = load.i32 notrap aligned region4 v14 -;; v16 = iconst.i32 1 -;; v17 = band v15, v16 ; v16 = 1 -;; v13 = iconst.i32 0 -;; v19 = icmp eq v17, v13 ; v13 = 0 -;; brif v19, block9, block10 +;; v12 = load.i64 notrap aligned readonly can_move region3 v4+136 +;; v13 = load.i32 notrap aligned region4 v12 +;; v14 = iconst.i32 1 +;; v15 = band v13, v14 ; v14 = 1 +;; v11 = iconst.i32 0 +;; v17 = icmp eq v15, v11 ; v11 = 0 +;; brif v17, block9, block10 ;; ;; block9: -;; v23 = load.i64 notrap aligned readonly can_move region6 v4+88 -;; v22 = load.i64 notrap aligned readonly can_move region5 v4+104 -;; v21 = iconst.i32 23 -;; try_call_indirect v23(v22, v4, v21), sig1, block11, [ context v4, default: block8(exn0) ] ; v21 = 23 +;; v21 = load.i64 notrap aligned readonly can_move region6 v4+88 +;; v20 = load.i64 notrap aligned readonly can_move region5 v4+104 +;; v19 = iconst.i32 23 +;; try_call_indirect v21(v20, v4, v19), sig1, block11, [ context v4, default: block8(exn0) ] ; v19 = 23 ;; ;; block11: ;; trap user12 ;; ;; block10: -;; v28 = load.i64 notrap aligned readonly can_move region7 v4+112 -;; v29 = load.i32 notrap aligned region4 v28 -;; v30 = iconst.i32 -2 -;; v31 = band v29, v30 ; v30 = -2 -;; store notrap aligned region4 v31, v28 -;; v61 = iconst.i32 1 -;; v62 = bor v29, v61 ; v61 = 1 -;; store notrap aligned region4 v62, v28 +;; v26 = load.i64 notrap aligned readonly can_move region7 v4+112 +;; v27 = load.i32 notrap aligned region4 v26 +;; v28 = iconst.i32 -2 +;; v29 = band v27, v28 ; v28 = -2 +;; store notrap aligned region4 v29, v26 +;; v59 = iconst.i32 1 +;; v60 = bor v27, v59 ; v59 = 1 +;; store notrap aligned region4 v60, v26 ;; jump block13 ;; ;; block13: @@ -125,21 +125,21 @@ ;; jump block12 ;; ;; block12: -;; v42 = load.i32 notrap aligned region4 v14 -;; v63 = iconst.i32 -2 -;; v64 = band v42, v63 ; v63 = -2 -;; store notrap aligned region4 v64, v14 -;; v65 = iconst.i32 1 -;; v66 = bor v42, v65 ; v65 = 1 -;; store notrap aligned region4 v66, v14 +;; v40 = load.i32 notrap aligned region4 v12 +;; v61 = iconst.i32 -2 +;; v62 = band v40, v61 ; v61 = -2 +;; store notrap aligned region4 v62, v12 +;; v63 = iconst.i32 1 +;; v64 = bor v40, v63 ; v63 = 1 +;; store notrap aligned region4 v64, v12 ;; jump block7 ;; ;; block7: ;; jump block4 ;; ;; block5: -;; v25 = iconst.i32 49 -;; call_indirect.i64 sig1, v23(v22, v4, v25) ; v25 = 49 +;; v23 = iconst.i32 49 +;; call_indirect.i64 sig1, v21(v20, v4, v23) ; v23 = 49 ;; trap user12 ;; ;; block4: @@ -152,6 +152,6 @@ ;; @00f0 jump block1 ;; ;; block1: -;; v53 = iconst.i32 1276 -;; @00f0 return v53 ; v53 = 1276 +;; v51 = iconst.i32 1276 +;; @00f0 return v51 ; v51 = 1276 ;; } diff --git a/tests/disas/component-model/direct-adapter-calls.wat b/tests/disas/component-model/direct-adapter-calls.wat index 5e24a00ea01d..b56d253d7d2c 100644 --- a/tests/disas/component-model/direct-adapter-calls.wat +++ b/tests/disas/component-model/direct-adapter-calls.wat @@ -115,61 +115,61 @@ ;; block0(v0: i64, v1: i64, v2: i32): ;; @007b jump block4 ;; -;; block6(v7: i64): +;; block6(v5: i64): ;; @007b jump block3 ;; ;; block4: -;; @0080 v9 = load.i64 notrap aligned readonly can_move region2 v0+136 -;; @0080 v10 = load.i32 notrap aligned region3 v9 -;; @0082 v11 = iconst.i32 1 -;; @0084 v12 = band v10, v11 ; v11 = 1 +;; @0080 v7 = load.i64 notrap aligned readonly can_move region2 v0+136 +;; @0080 v8 = load.i32 notrap aligned region3 v7 +;; @0082 v9 = iconst.i32 1 +;; @0084 v10 = band v8, v9 ; v9 = 1 ;; @0075 v4 = iconst.i32 0 -;; @0085 v14 = icmp eq v12, v4 ; v4 = 0 -;; @0086 brif v14, block7, block8 +;; @0085 v12 = icmp eq v10, v4 ; v4 = 0 +;; @0086 brif v12, block7, block8 ;; ;; block7: -;; @008a v18 = load.i64 notrap aligned readonly can_move region5 v0+88 -;; @008a v17 = load.i64 notrap aligned readonly can_move region4 v0+104 -;; @0088 v16 = iconst.i32 23 -;; @008a try_call_indirect v18(v17, v0, v16), sig0, block9, [ context v0, default: block6(exn0) ] ; v16 = 23 +;; @008a v16 = load.i64 notrap aligned readonly can_move region5 v0+88 +;; @008a v15 = load.i64 notrap aligned readonly can_move region4 v0+104 +;; @0088 v14 = iconst.i32 23 +;; @008a try_call_indirect v16(v15, v0, v14), sig0, block9, [ context v0, default: block6(exn0) ] ; v14 = 23 ;; ;; block9: ;; @008c trap user12 ;; ;; block8: -;; @008e v19 = load.i64 notrap aligned readonly can_move region6 v0+112 -;; @008e v20 = load.i32 notrap aligned region3 v19 -;; @0090 v21 = iconst.i32 -2 -;; @0092 v22 = band v20, v21 ; v21 = -2 -;; @0093 store notrap aligned region3 v22, v19 -;; v48 = iconst.i32 1 -;; v49 = bor v20, v48 ; v48 = 1 -;; @009c store notrap aligned region3 v49, v19 -;; @009e v29 = load.i64 notrap aligned readonly can_move region7 v0+72 -;; @009e try_call fn0(v29, v0, v2), sig1, block10(ret0), [ context v0, default: block6(exn0) ] -;; -;; block10(v30: i32): -;; @00a2 v32 = load.i32 notrap aligned region3 v9 -;; v50 = iconst.i32 -2 -;; v51 = band v32, v50 ; v50 = -2 -;; @00a7 store notrap aligned region3 v51, v9 -;; v52 = iconst.i32 1 -;; v53 = bor v32, v52 ; v52 = 1 -;; @00b0 store notrap aligned region3 v53, v9 -;; @00b2 jump block5(v30) -;; -;; block5(v6: i32): -;; @00b3 jump block2(v6) +;; @008e v17 = load.i64 notrap aligned readonly can_move region6 v0+112 +;; @008e v18 = load.i32 notrap aligned region3 v17 +;; @0090 v19 = iconst.i32 -2 +;; @0092 v20 = band v18, v19 ; v19 = -2 +;; @0093 store notrap aligned region3 v20, v17 +;; v46 = iconst.i32 1 +;; v47 = bor v18, v46 ; v46 = 1 +;; @009c store notrap aligned region3 v47, v17 +;; @009e v27 = load.i64 notrap aligned readonly can_move region7 v0+72 +;; @009e try_call fn0(v27, v0, v2), sig1, block10(ret0), [ context v0, default: block6(exn0) ] +;; +;; block10(v28: i32): +;; @00a2 v30 = load.i32 notrap aligned region3 v7 +;; v48 = iconst.i32 -2 +;; v49 = band v30, v48 ; v48 = -2 +;; @00a7 store notrap aligned region3 v49, v7 +;; v50 = iconst.i32 1 +;; v51 = bor v30, v50 ; v50 = 1 +;; @00b0 store notrap aligned region3 v51, v7 +;; @00b2 jump block5 +;; +;; block5: +;; @00b3 jump block2 ;; ;; block3: -;; v54 = load.i64 notrap aligned readonly can_move region5 v0+88 -;; v55 = load.i64 notrap aligned readonly can_move region4 v0+104 -;; @00b6 v41 = iconst.i32 49 -;; @00b8 call_indirect sig0, v54(v55, v0, v41) ; v41 = 49 +;; v52 = load.i64 notrap aligned readonly can_move region5 v0+88 +;; v53 = load.i64 notrap aligned readonly can_move region4 v0+104 +;; @00b6 v39 = iconst.i32 49 +;; @00b8 call_indirect sig0, v52(v53, v0, v39) ; v39 = 49 ;; @00ba trap user12 ;; -;; block2(v5: i32): -;; @00bc jump block1(v5) +;; block2: +;; @00bc jump block1(v28) ;; ;; block1(v3: i32): ;; @00bc return v3 diff --git a/tests/disas/fac-multi-value.wat b/tests/disas/fac-multi-value.wat index e0855fdc0559..4981f4da1cd4 100644 --- a/tests/disas/fac-multi-value.wat +++ b/tests/disas/fac-multi-value.wat @@ -67,18 +67,18 @@ ;; @0050 jump block2(v4, v2) ; v4 = 1 ;; ;; block2(v5: i64, v6: i64): -;; @0052 v8, v9, v10 = call fn0(v0, v0, v5, v6) -;; @0054 v11, v12, v13 = call fn0(v0, v0, v9, v10) -;; @0056 v14 = imul v12, v13 -;; @0057 v15, v16, v17 = call fn0(v0, v0, v11, v14) -;; @0059 v18 = iconst.i64 1 -;; @005b v19 = isub v17, v18 ; v18 = 1 -;; @005c v20, v21 = call fn1(v0, v0, v19) -;; @005e v22 = iconst.i64 0 -;; @0060 v23 = icmp ugt v21, v22 ; v22 = 0 -;; @0060 v24 = uextend.i32 v23 -;; @0061 brif v24, block2(v16, v20), block4 +;; @0052 v7, v8, v9 = call fn0(v0, v0, v5, v6) +;; @0054 v10, v11, v12 = call fn0(v0, v0, v8, v9) +;; @0056 v13 = imul v11, v12 +;; @0057 v14, v15, v16 = call fn0(v0, v0, v10, v13) +;; @0059 v17 = iconst.i64 1 +;; @005b v18 = isub v16, v17 ; v17 = 1 +;; @005c v19, v20 = call fn1(v0, v0, v18) +;; @005e v21 = iconst.i64 0 +;; @0060 v22 = icmp ugt v20, v21 ; v21 = 0 +;; @0060 v23 = uextend.i32 v22 +;; @0061 brif v23, block2(v15, v19), block4 ;; ;; block4: -;; @0064 return v16 +;; @0064 return v15 ;; } diff --git a/tests/disas/gc/copying/br-on-cast-fail.wat b/tests/disas/gc/copying/br-on-cast-fail.wat index 168a7f40ad50..630d4e76c0ce 100644 --- a/tests/disas/gc/copying/br-on-cast-fail.wat +++ b/tests/disas/gc/copying/br-on-cast-fail.wat @@ -33,42 +33,42 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @002e v4 = iconst.i32 0 -;; @002e v5 = icmp eq v2, v4 ; v4 = 0 -;; @002e brif v5, block5(v4), block3 ; v4 = 0 +;; @002e v3 = iconst.i32 0 +;; @002e v4 = icmp eq v2, v3 ; v3 = 0 +;; @002e brif v4, block5(v3), block3 ; v3 = 0 ;; ;; block3: -;; @002e v8 = iconst.i32 1 -;; @002e v9 = band.i32 v2, v8 ; v8 = 1 -;; v27 = iconst.i32 0 -;; @002e brif v9, block5(v27), block4 ; v27 = 0 +;; @002e v7 = iconst.i32 1 +;; @002e v8 = band.i32 v2, v7 ; v7 = 1 +;; v26 = iconst.i32 0 +;; @002e brif v8, block5(v26), block4 ; v26 = 0 ;; ;; block4: -;; @002e v14 = load.i64 notrap aligned readonly can_move region0 v0+8 -;; @002e v15 = load.i64 notrap aligned readonly can_move region3 v14+32 -;; @002e v13 = uextend.i64 v2 -;; @002e v16 = iadd v15, v13 -;; @002e v17 = iconst.i64 4 -;; @002e v18 = iadd v16, v17 ; v17 = 4 -;; @002e v19 = load.i32 user2 readonly region5 v18 -;; @002e v11 = load.i64 notrap aligned readonly can_move region2 v0+40 -;; @002e v12 = load.i32 notrap aligned readonly can_move v11 -;; @002e v20 = icmp eq v19, v12 -;; @002e v21 = uextend.i32 v20 -;; @002e jump block5(v21) +;; @002e v13 = load.i64 notrap aligned readonly can_move region0 v0+8 +;; @002e v14 = load.i64 notrap aligned readonly can_move region3 v13+32 +;; @002e v12 = uextend.i64 v2 +;; @002e v15 = iadd v14, v12 +;; @002e v16 = iconst.i64 4 +;; @002e v17 = iadd v15, v16 ; v16 = 4 +;; @002e v18 = load.i32 user2 readonly region5 v17 +;; @002e v10 = load.i64 notrap aligned readonly can_move region2 v0+40 +;; @002e v11 = load.i32 notrap aligned readonly can_move v10 +;; @002e v19 = icmp eq v18, v11 +;; @002e v20 = uextend.i32 v19 +;; @002e jump block5(v20) ;; -;; block5(v22: i32): -;; @002e brif v22, block6, block2 +;; block5(v21: i32): +;; @002e brif v21, block6, block2 ;; ;; block6: -;; @0034 v24 = load.i64 notrap aligned readonly can_move region7 v0+56 -;; @0034 v23 = load.i64 notrap aligned readonly can_move region6 v0+72 -;; @0034 call_indirect sig0, v24(v23, v0) +;; @0034 v23 = load.i64 notrap aligned readonly can_move region7 v0+56 +;; @0034 v22 = load.i64 notrap aligned readonly can_move region6 v0+72 +;; @0034 call_indirect sig0, v23(v22, v0) ;; @0036 return ;; ;; block2: -;; @0038 v26 = load.i64 notrap aligned readonly can_move region9 v0+88 -;; @0038 v25 = load.i64 notrap aligned readonly can_move region8 v0+104 -;; @0038 call_indirect sig0, v26(v25, v0) +;; @0038 v25 = load.i64 notrap aligned readonly can_move region9 v0+88 +;; @0038 v24 = load.i64 notrap aligned readonly can_move region8 v0+104 +;; @0038 call_indirect sig0, v25(v24, v0) ;; @003a return ;; } diff --git a/tests/disas/gc/copying/br-on-cast.wat b/tests/disas/gc/copying/br-on-cast.wat index 1da60977423f..1248a092a5ca 100644 --- a/tests/disas/gc/copying/br-on-cast.wat +++ b/tests/disas/gc/copying/br-on-cast.wat @@ -33,42 +33,42 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @002f v4 = iconst.i32 0 -;; @002f v5 = icmp eq v2, v4 ; v4 = 0 -;; @002f brif v5, block5(v4), block3 ; v4 = 0 +;; @002f v3 = iconst.i32 0 +;; @002f v4 = icmp eq v2, v3 ; v3 = 0 +;; @002f brif v4, block5(v3), block3 ; v3 = 0 ;; ;; block3: -;; @002f v8 = iconst.i32 1 -;; @002f v9 = band.i32 v2, v8 ; v8 = 1 -;; v27 = iconst.i32 0 -;; @002f brif v9, block5(v27), block4 ; v27 = 0 +;; @002f v7 = iconst.i32 1 +;; @002f v8 = band.i32 v2, v7 ; v7 = 1 +;; v26 = iconst.i32 0 +;; @002f brif v8, block5(v26), block4 ; v26 = 0 ;; ;; block4: -;; @002f v14 = load.i64 notrap aligned readonly can_move region0 v0+8 -;; @002f v15 = load.i64 notrap aligned readonly can_move region3 v14+32 -;; @002f v13 = uextend.i64 v2 -;; @002f v16 = iadd v15, v13 -;; @002f v17 = iconst.i64 4 -;; @002f v18 = iadd v16, v17 ; v17 = 4 -;; @002f v19 = load.i32 user2 readonly region5 v18 -;; @002f v11 = load.i64 notrap aligned readonly can_move region2 v0+40 -;; @002f v12 = load.i32 notrap aligned readonly can_move v11 -;; @002f v20 = icmp eq v19, v12 -;; @002f v21 = uextend.i32 v20 -;; @002f jump block5(v21) +;; @002f v13 = load.i64 notrap aligned readonly can_move region0 v0+8 +;; @002f v14 = load.i64 notrap aligned readonly can_move region3 v13+32 +;; @002f v12 = uextend.i64 v2 +;; @002f v15 = iadd v14, v12 +;; @002f v16 = iconst.i64 4 +;; @002f v17 = iadd v15, v16 ; v16 = 4 +;; @002f v18 = load.i32 user2 readonly region5 v17 +;; @002f v10 = load.i64 notrap aligned readonly can_move region2 v0+40 +;; @002f v11 = load.i32 notrap aligned readonly can_move v10 +;; @002f v19 = icmp eq v18, v11 +;; @002f v20 = uextend.i32 v19 +;; @002f jump block5(v20) ;; -;; block5(v22: i32): -;; @002f brif v22, block2, block6 +;; block5(v21: i32): +;; @002f brif v21, block2, block6 ;; ;; block6: -;; @0035 v24 = load.i64 notrap aligned readonly can_move region7 v0+56 -;; @0035 v23 = load.i64 notrap aligned readonly can_move region6 v0+72 -;; @0035 call_indirect sig0, v24(v23, v0) +;; @0035 v23 = load.i64 notrap aligned readonly can_move region7 v0+56 +;; @0035 v22 = load.i64 notrap aligned readonly can_move region6 v0+72 +;; @0035 call_indirect sig0, v23(v22, v0) ;; @0037 return ;; ;; block2: -;; @0039 v26 = load.i64 notrap aligned readonly can_move region9 v0+88 -;; @0039 v25 = load.i64 notrap aligned readonly can_move region8 v0+104 -;; @0039 call_indirect sig0, v26(v25, v0) +;; @0039 v25 = load.i64 notrap aligned readonly can_move region9 v0+88 +;; @0039 v24 = load.i64 notrap aligned readonly can_move region8 v0+104 +;; @0039 call_indirect sig0, v25(v24, v0) ;; @003b return ;; } diff --git a/tests/disas/gc/drc/br-on-cast-fail.wat b/tests/disas/gc/drc/br-on-cast-fail.wat index 48e01543760e..e6763e9efc2f 100644 --- a/tests/disas/gc/drc/br-on-cast-fail.wat +++ b/tests/disas/gc/drc/br-on-cast-fail.wat @@ -34,42 +34,42 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @002e v4 = iconst.i32 0 -;; @002e v5 = icmp eq v2, v4 ; v4 = 0 -;; @002e brif v5, block5(v4), block3 ; v4 = 0 +;; @002e v3 = iconst.i32 0 +;; @002e v4 = icmp eq v2, v3 ; v3 = 0 +;; @002e brif v4, block5(v3), block3 ; v3 = 0 ;; ;; block3: -;; @002e v8 = iconst.i32 1 -;; @002e v9 = band.i32 v2, v8 ; v8 = 1 -;; v27 = iconst.i32 0 -;; @002e brif v9, block5(v27), block4 ; v27 = 0 +;; @002e v7 = iconst.i32 1 +;; @002e v8 = band.i32 v2, v7 ; v7 = 1 +;; v26 = iconst.i32 0 +;; @002e brif v8, block5(v26), block4 ; v26 = 0 ;; ;; block4: -;; @002e v14 = load.i64 notrap aligned readonly can_move region0 v0+8 -;; @002e v15 = load.i64 notrap aligned readonly can_move region3 v14+32 -;; @002e v13 = uextend.i64 v2 -;; @002e v16 = iadd v15, v13 -;; @002e v17 = iconst.i64 4 -;; @002e v18 = iadd v16, v17 ; v17 = 4 -;; @002e v19 = load.i32 user2 readonly region5 v18 -;; @002e v11 = load.i64 notrap aligned readonly can_move region2 v0+40 -;; @002e v12 = load.i32 notrap aligned readonly can_move v11 -;; @002e v20 = icmp eq v19, v12 -;; @002e v21 = uextend.i32 v20 -;; @002e jump block5(v21) +;; @002e v13 = load.i64 notrap aligned readonly can_move region0 v0+8 +;; @002e v14 = load.i64 notrap aligned readonly can_move region3 v13+32 +;; @002e v12 = uextend.i64 v2 +;; @002e v15 = iadd v14, v12 +;; @002e v16 = iconst.i64 4 +;; @002e v17 = iadd v15, v16 ; v16 = 4 +;; @002e v18 = load.i32 user2 readonly region5 v17 +;; @002e v10 = load.i64 notrap aligned readonly can_move region2 v0+40 +;; @002e v11 = load.i32 notrap aligned readonly can_move v10 +;; @002e v19 = icmp eq v18, v11 +;; @002e v20 = uextend.i32 v19 +;; @002e jump block5(v20) ;; -;; block5(v22: i32): -;; @002e brif v22, block6, block2 +;; block5(v21: i32): +;; @002e brif v21, block6, block2 ;; ;; block6: -;; @0034 v24 = load.i64 notrap aligned readonly can_move region7 v0+56 -;; @0034 v23 = load.i64 notrap aligned readonly can_move region6 v0+72 -;; @0034 call_indirect sig0, v24(v23, v0) +;; @0034 v23 = load.i64 notrap aligned readonly can_move region7 v0+56 +;; @0034 v22 = load.i64 notrap aligned readonly can_move region6 v0+72 +;; @0034 call_indirect sig0, v23(v22, v0) ;; @0036 return ;; ;; block2: -;; @0038 v26 = load.i64 notrap aligned readonly can_move region9 v0+88 -;; @0038 v25 = load.i64 notrap aligned readonly can_move region8 v0+104 -;; @0038 call_indirect sig0, v26(v25, v0) +;; @0038 v25 = load.i64 notrap aligned readonly can_move region9 v0+88 +;; @0038 v24 = load.i64 notrap aligned readonly can_move region8 v0+104 +;; @0038 call_indirect sig0, v25(v24, v0) ;; @003a return ;; } diff --git a/tests/disas/gc/drc/br-on-cast.wat b/tests/disas/gc/drc/br-on-cast.wat index 90aa42eaebb8..cd4ddcb5c4e0 100644 --- a/tests/disas/gc/drc/br-on-cast.wat +++ b/tests/disas/gc/drc/br-on-cast.wat @@ -34,42 +34,42 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @002f v4 = iconst.i32 0 -;; @002f v5 = icmp eq v2, v4 ; v4 = 0 -;; @002f brif v5, block5(v4), block3 ; v4 = 0 +;; @002f v3 = iconst.i32 0 +;; @002f v4 = icmp eq v2, v3 ; v3 = 0 +;; @002f brif v4, block5(v3), block3 ; v3 = 0 ;; ;; block3: -;; @002f v8 = iconst.i32 1 -;; @002f v9 = band.i32 v2, v8 ; v8 = 1 -;; v27 = iconst.i32 0 -;; @002f brif v9, block5(v27), block4 ; v27 = 0 +;; @002f v7 = iconst.i32 1 +;; @002f v8 = band.i32 v2, v7 ; v7 = 1 +;; v26 = iconst.i32 0 +;; @002f brif v8, block5(v26), block4 ; v26 = 0 ;; ;; block4: -;; @002f v14 = load.i64 notrap aligned readonly can_move region0 v0+8 -;; @002f v15 = load.i64 notrap aligned readonly can_move region3 v14+32 -;; @002f v13 = uextend.i64 v2 -;; @002f v16 = iadd v15, v13 -;; @002f v17 = iconst.i64 4 -;; @002f v18 = iadd v16, v17 ; v17 = 4 -;; @002f v19 = load.i32 user2 readonly region5 v18 -;; @002f v11 = load.i64 notrap aligned readonly can_move region2 v0+40 -;; @002f v12 = load.i32 notrap aligned readonly can_move v11 -;; @002f v20 = icmp eq v19, v12 -;; @002f v21 = uextend.i32 v20 -;; @002f jump block5(v21) +;; @002f v13 = load.i64 notrap aligned readonly can_move region0 v0+8 +;; @002f v14 = load.i64 notrap aligned readonly can_move region3 v13+32 +;; @002f v12 = uextend.i64 v2 +;; @002f v15 = iadd v14, v12 +;; @002f v16 = iconst.i64 4 +;; @002f v17 = iadd v15, v16 ; v16 = 4 +;; @002f v18 = load.i32 user2 readonly region5 v17 +;; @002f v10 = load.i64 notrap aligned readonly can_move region2 v0+40 +;; @002f v11 = load.i32 notrap aligned readonly can_move v10 +;; @002f v19 = icmp eq v18, v11 +;; @002f v20 = uextend.i32 v19 +;; @002f jump block5(v20) ;; -;; block5(v22: i32): -;; @002f brif v22, block2, block6 +;; block5(v21: i32): +;; @002f brif v21, block2, block6 ;; ;; block6: -;; @0035 v24 = load.i64 notrap aligned readonly can_move region7 v0+56 -;; @0035 v23 = load.i64 notrap aligned readonly can_move region6 v0+72 -;; @0035 call_indirect sig0, v24(v23, v0) +;; @0035 v23 = load.i64 notrap aligned readonly can_move region7 v0+56 +;; @0035 v22 = load.i64 notrap aligned readonly can_move region6 v0+72 +;; @0035 call_indirect sig0, v23(v22, v0) ;; @0037 return ;; ;; block2: -;; @0039 v26 = load.i64 notrap aligned readonly can_move region9 v0+88 -;; @0039 v25 = load.i64 notrap aligned readonly can_move region8 v0+104 -;; @0039 call_indirect sig0, v26(v25, v0) +;; @0039 v25 = load.i64 notrap aligned readonly can_move region9 v0+88 +;; @0039 v24 = load.i64 notrap aligned readonly can_move region8 v0+104 +;; @0039 call_indirect sig0, v25(v24, v0) ;; @003b return ;; } diff --git a/tests/disas/gc/null/br-on-cast-fail.wat b/tests/disas/gc/null/br-on-cast-fail.wat index 9df6d68d37ee..4647b112b070 100644 --- a/tests/disas/gc/null/br-on-cast-fail.wat +++ b/tests/disas/gc/null/br-on-cast-fail.wat @@ -34,42 +34,42 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @002e v4 = iconst.i32 0 -;; @002e v5 = icmp eq v2, v4 ; v4 = 0 -;; @002e brif v5, block5(v4), block3 ; v4 = 0 +;; @002e v3 = iconst.i32 0 +;; @002e v4 = icmp eq v2, v3 ; v3 = 0 +;; @002e brif v4, block5(v3), block3 ; v3 = 0 ;; ;; block3: -;; @002e v8 = iconst.i32 1 -;; @002e v9 = band.i32 v2, v8 ; v8 = 1 -;; v27 = iconst.i32 0 -;; @002e brif v9, block5(v27), block4 ; v27 = 0 +;; @002e v7 = iconst.i32 1 +;; @002e v8 = band.i32 v2, v7 ; v7 = 1 +;; v26 = iconst.i32 0 +;; @002e brif v8, block5(v26), block4 ; v26 = 0 ;; ;; block4: -;; @002e v14 = load.i64 notrap aligned readonly can_move region0 v0+8 -;; @002e v15 = load.i64 notrap aligned readonly can_move region3 v14+32 -;; @002e v13 = uextend.i64 v2 -;; @002e v16 = iadd v15, v13 -;; @002e v17 = iconst.i64 4 -;; @002e v18 = iadd v16, v17 ; v17 = 4 -;; @002e v19 = load.i32 user2 readonly region5 v18 -;; @002e v11 = load.i64 notrap aligned readonly can_move region2 v0+40 -;; @002e v12 = load.i32 notrap aligned readonly can_move v11 -;; @002e v20 = icmp eq v19, v12 -;; @002e v21 = uextend.i32 v20 -;; @002e jump block5(v21) +;; @002e v13 = load.i64 notrap aligned readonly can_move region0 v0+8 +;; @002e v14 = load.i64 notrap aligned readonly can_move region3 v13+32 +;; @002e v12 = uextend.i64 v2 +;; @002e v15 = iadd v14, v12 +;; @002e v16 = iconst.i64 4 +;; @002e v17 = iadd v15, v16 ; v16 = 4 +;; @002e v18 = load.i32 user2 readonly region5 v17 +;; @002e v10 = load.i64 notrap aligned readonly can_move region2 v0+40 +;; @002e v11 = load.i32 notrap aligned readonly can_move v10 +;; @002e v19 = icmp eq v18, v11 +;; @002e v20 = uextend.i32 v19 +;; @002e jump block5(v20) ;; -;; block5(v22: i32): -;; @002e brif v22, block6, block2 +;; block5(v21: i32): +;; @002e brif v21, block6, block2 ;; ;; block6: -;; @0034 v24 = load.i64 notrap aligned readonly can_move region7 v0+56 -;; @0034 v23 = load.i64 notrap aligned readonly can_move region6 v0+72 -;; @0034 call_indirect sig0, v24(v23, v0) +;; @0034 v23 = load.i64 notrap aligned readonly can_move region7 v0+56 +;; @0034 v22 = load.i64 notrap aligned readonly can_move region6 v0+72 +;; @0034 call_indirect sig0, v23(v22, v0) ;; @0036 return ;; ;; block2: -;; @0038 v26 = load.i64 notrap aligned readonly can_move region9 v0+88 -;; @0038 v25 = load.i64 notrap aligned readonly can_move region8 v0+104 -;; @0038 call_indirect sig0, v26(v25, v0) +;; @0038 v25 = load.i64 notrap aligned readonly can_move region9 v0+88 +;; @0038 v24 = load.i64 notrap aligned readonly can_move region8 v0+104 +;; @0038 call_indirect sig0, v25(v24, v0) ;; @003a return ;; } diff --git a/tests/disas/gc/null/br-on-cast.wat b/tests/disas/gc/null/br-on-cast.wat index 8058bd4d2623..64b081b385ea 100644 --- a/tests/disas/gc/null/br-on-cast.wat +++ b/tests/disas/gc/null/br-on-cast.wat @@ -34,42 +34,42 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @002f v4 = iconst.i32 0 -;; @002f v5 = icmp eq v2, v4 ; v4 = 0 -;; @002f brif v5, block5(v4), block3 ; v4 = 0 +;; @002f v3 = iconst.i32 0 +;; @002f v4 = icmp eq v2, v3 ; v3 = 0 +;; @002f brif v4, block5(v3), block3 ; v3 = 0 ;; ;; block3: -;; @002f v8 = iconst.i32 1 -;; @002f v9 = band.i32 v2, v8 ; v8 = 1 -;; v27 = iconst.i32 0 -;; @002f brif v9, block5(v27), block4 ; v27 = 0 +;; @002f v7 = iconst.i32 1 +;; @002f v8 = band.i32 v2, v7 ; v7 = 1 +;; v26 = iconst.i32 0 +;; @002f brif v8, block5(v26), block4 ; v26 = 0 ;; ;; block4: -;; @002f v14 = load.i64 notrap aligned readonly can_move region0 v0+8 -;; @002f v15 = load.i64 notrap aligned readonly can_move region3 v14+32 -;; @002f v13 = uextend.i64 v2 -;; @002f v16 = iadd v15, v13 -;; @002f v17 = iconst.i64 4 -;; @002f v18 = iadd v16, v17 ; v17 = 4 -;; @002f v19 = load.i32 user2 readonly region5 v18 -;; @002f v11 = load.i64 notrap aligned readonly can_move region2 v0+40 -;; @002f v12 = load.i32 notrap aligned readonly can_move v11 -;; @002f v20 = icmp eq v19, v12 -;; @002f v21 = uextend.i32 v20 -;; @002f jump block5(v21) +;; @002f v13 = load.i64 notrap aligned readonly can_move region0 v0+8 +;; @002f v14 = load.i64 notrap aligned readonly can_move region3 v13+32 +;; @002f v12 = uextend.i64 v2 +;; @002f v15 = iadd v14, v12 +;; @002f v16 = iconst.i64 4 +;; @002f v17 = iadd v15, v16 ; v16 = 4 +;; @002f v18 = load.i32 user2 readonly region5 v17 +;; @002f v10 = load.i64 notrap aligned readonly can_move region2 v0+40 +;; @002f v11 = load.i32 notrap aligned readonly can_move v10 +;; @002f v19 = icmp eq v18, v11 +;; @002f v20 = uextend.i32 v19 +;; @002f jump block5(v20) ;; -;; block5(v22: i32): -;; @002f brif v22, block2, block6 +;; block5(v21: i32): +;; @002f brif v21, block2, block6 ;; ;; block6: -;; @0035 v24 = load.i64 notrap aligned readonly can_move region7 v0+56 -;; @0035 v23 = load.i64 notrap aligned readonly can_move region6 v0+72 -;; @0035 call_indirect sig0, v24(v23, v0) +;; @0035 v23 = load.i64 notrap aligned readonly can_move region7 v0+56 +;; @0035 v22 = load.i64 notrap aligned readonly can_move region6 v0+72 +;; @0035 call_indirect sig0, v23(v22, v0) ;; @0037 return ;; ;; block2: -;; @0039 v26 = load.i64 notrap aligned readonly can_move region9 v0+88 -;; @0039 v25 = load.i64 notrap aligned readonly can_move region8 v0+104 -;; @0039 call_indirect sig0, v26(v25, v0) +;; @0039 v25 = load.i64 notrap aligned readonly can_move region9 v0+88 +;; @0039 v24 = load.i64 notrap aligned readonly can_move region8 v0+104 +;; @0039 call_indirect sig0, v25(v24, v0) ;; @003b return ;; } diff --git a/tests/disas/if-unreachable-else-params-2.wat b/tests/disas/if-unreachable-else-params-2.wat index 349794c2d849..0046e44f0cc2 100644 --- a/tests/disas/if-unreachable-else-params-2.wat +++ b/tests/disas/if-unreachable-else-params-2.wat @@ -35,10 +35,10 @@ ;; @0056 brif v3, block2, block4 ;; ;; block2: -;; @0058 v7 = uextend.i64 v2 -;; @0058 v8 = load.i64 notrap aligned readonly can_move region2 v0+56 -;; @0058 v9 = iadd v8, v7 -;; @0058 v10 = sload16.i64 little region4 v9 +;; @0058 v6 = uextend.i64 v2 +;; @0058 v7 = load.i64 notrap aligned readonly can_move region2 v0+56 +;; @0058 v8 = iadd v7, v6 +;; @0058 v9 = sload16.i64 little region4 v8 ;; @005c jump block3 ;; ;; block4: diff --git a/tests/disas/if-unreachable-else-params.wat b/tests/disas/if-unreachable-else-params.wat index 57de84282a10..9f6ebd830f18 100644 --- a/tests/disas/if-unreachable-else-params.wat +++ b/tests/disas/if-unreachable-else-params.wat @@ -61,13 +61,13 @@ ;; @0049 brif.i32 v2, block4, block6 ;; ;; block4: -;; @004b v7 = uextend.i64 v3 ; v3 = 35 -;; @004b v8 = load.i64 notrap aligned readonly can_move region2 v0+56 -;; @004b v9 = iadd v8, v7 -;; @004b v10 = sload16.i64 little region4 v9 +;; @004b v6 = uextend.i64 v3 ; v3 = 35 +;; @004b v7 = load.i64 notrap aligned readonly can_move region2 v0+56 +;; @004b v8 = iadd v7, v6 +;; @004b v9 = sload16.i64 little region4 v8 ;; @004e trap user12 ;; ;; block6: -;; @005d v11 = popcnt.i32 v3 ; v3 = 35 +;; @005d v10 = popcnt.i32 v3 ; v3 = 35 ;; @0060 return ;; } diff --git a/tests/disas/multi-1.wat b/tests/disas/multi-1.wat index 2f44d90c2485..867a353e3aa7 100644 --- a/tests/disas/multi-1.wat +++ b/tests/disas/multi-1.wat @@ -16,12 +16,12 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i64, v3: i32): -;; @003a v10 = f64const 0x1.34a0000000000p10 +;; @003a v7 = f64const 0x1.34a0000000000p10 ;; @0043 jump block2 ;; ;; block2: ;; @0044 jump block1 ;; ;; block1: -;; @0044 return v3, v2, v10 ; v10 = 0x1.34a0000000000p10 +;; @0044 return v3, v2, v7 ; v7 = 0x1.34a0000000000p10 ;; } diff --git a/tests/disas/multi-10.wat b/tests/disas/multi-10.wat index 08ab623d03e7..e795c49b1814 100644 --- a/tests/disas/multi-10.wat +++ b/tests/disas/multi-10.wat @@ -23,15 +23,15 @@ ;; @002c brif v3, block2, block4 ;; ;; block2: -;; @002e v9 = iconst.i64 -1 -;; @0030 jump block3(v9) ; v9 = -1 +;; @002e v6 = iconst.i64 -1 +;; @0030 jump block3(v6) ; v6 = -1 ;; ;; block4: -;; @0031 v10 = iconst.i64 -2 -;; @0033 jump block3(v10) ; v10 = -2 +;; @0031 v7 = iconst.i64 -2 +;; @0033 jump block3(v7) ; v7 = -2 ;; -;; block3(v7: i64): -;; @0034 jump block1(v7) +;; block3(v9: i64): +;; @0034 jump block1(v9) ;; ;; block1(v5: i64): ;; @0034 return v2, v5 diff --git a/tests/disas/multi-11.wat b/tests/disas/multi-11.wat index c54cd5d6404f..e235d184ffcb 100644 --- a/tests/disas/multi-11.wat +++ b/tests/disas/multi-11.wat @@ -20,6 +20,6 @@ ;; @002b jump block2 ;; ;; block2: -;; @002d v8 = iconst.i64 42 -;; @002f return v2, v8 ; v8 = 42 +;; @002d v6 = iconst.i64 42 +;; @002f return v2, v6 ; v6 = 42 ;; } diff --git a/tests/disas/multi-13.wat b/tests/disas/multi-13.wat index 66f0cf5760ba..800c8e05deb8 100644 --- a/tests/disas/multi-13.wat +++ b/tests/disas/multi-13.wat @@ -23,8 +23,8 @@ ;; @002e brif v2, block3, block5 ;; ;; block3: -;; @0030 v7 = iconst.i32 3 -;; @0032 jump block2(v7) ; v7 = 3 +;; @0030 v5 = iconst.i32 3 +;; @0032 jump block2(v5) ; v5 = 3 ;; ;; block5: ;; @0037 jump block4 @@ -32,8 +32,8 @@ ;; block4: ;; @0038 jump block2(v3) ;; -;; block2(v5: i32): -;; @0039 jump block1(v5) +;; block2(v6: i32): +;; @0039 jump block1(v6) ;; ;; block1(v4: i32): ;; @0039 return v4 diff --git a/tests/disas/multi-14.wat b/tests/disas/multi-14.wat index d00938b5f3fd..4a9d6ef896c7 100644 --- a/tests/disas/multi-14.wat +++ b/tests/disas/multi-14.wat @@ -26,14 +26,14 @@ ;; @0032 jump block4 ;; ;; block5: -;; @0033 v7 = iconst.i32 4 -;; @0035 jump block2(v7) ; v7 = 4 +;; @0033 v5 = iconst.i32 4 +;; @0035 jump block2(v5) ; v5 = 4 ;; ;; block4: ;; @0038 jump block2(v3) ;; -;; block2(v5: i32): -;; @0039 jump block1(v5) +;; block2(v6: i32): +;; @0039 jump block1(v6) ;; ;; block1(v4: i32): ;; @0039 return v4 diff --git a/tests/disas/multi-16.wat b/tests/disas/multi-16.wat index 11a6d48a730c..1f422723f2f2 100644 --- a/tests/disas/multi-16.wat +++ b/tests/disas/multi-16.wat @@ -23,17 +23,17 @@ ;; @0028 brif v2, block2, block4 ;; ;; block2: -;; @002a v6 = iconst.i32 2 -;; @002c v7 = iadd.i32 v4, v6 ; v4 = 1, v6 = 2 -;; @002d jump block3(v7) +;; @002a v5 = iconst.i32 2 +;; @002c v6 = iadd.i32 v4, v5 ; v4 = 1, v5 = 2 +;; @002d jump block3(v6) ;; ;; block4: -;; @002e v9 = iconst.i32 -2 -;; @0030 v10 = iadd.i32 v4, v9 ; v4 = 1, v9 = -2 -;; @0031 jump block3(v10) +;; @002e v7 = iconst.i32 -2 +;; @0030 v8 = iadd.i32 v4, v7 ; v4 = 1, v7 = -2 +;; @0031 jump block3(v8) ;; -;; block3(v5: i32): -;; @0032 jump block1(v5) +;; block3(v9: i32): +;; @0032 jump block1(v9) ;; ;; block1(v3: i32): ;; @0032 return v3 diff --git a/tests/disas/multi-17.wat b/tests/disas/multi-17.wat index 0758a69f39a5..4bb18bf602ca 100644 --- a/tests/disas/multi-17.wat +++ b/tests/disas/multi-17.wat @@ -49,18 +49,18 @@ ;; @0031 jump block3(v9) ; v9 = 0 ;; ;; block4: -;; @0034 v15 = call fn0(v0, v0, v7, v8, v9) ; v7 = 0, v8 = 0, v9 = 0 -;; @0036 jump block3(v15) +;; @0034 v11 = call fn0(v0, v0, v7, v8, v9) ; v7 = 0, v8 = 0, v9 = 0 +;; @0036 jump block3(v11) ;; -;; block3(v11: i32): -;; @0037 v16 = iconst.i32 0 -;; @0039 v17 = iconst.i32 0 -;; @003b brif v17, block5, block7(v11) ; v17 = 0 +;; block3(v12: i32): +;; @0037 v13 = iconst.i32 0 +;; @0039 v14 = iconst.i32 0 +;; @003b brif v14, block5, block7 ; v14 = 0 ;; ;; block5: ;; @003f jump block6 ;; -;; block7(v20: i32): +;; block7: ;; @0042 jump block6 ;; ;; block6: diff --git a/tests/disas/multi-3.wat b/tests/disas/multi-3.wat index d27a5daef8d1..b6274749485c 100644 --- a/tests/disas/multi-3.wat +++ b/tests/disas/multi-3.wat @@ -29,13 +29,13 @@ ;; @0038 return v4, v3 ;; ;; block4: -;; @003c v11 = iconst.i64 0 -;; @003e v12 = iconst.i64 0 +;; @003c v7 = iconst.i64 0 +;; @003e v8 = iconst.i64 0 ;; @0040 jump block3 ;; ;; block3: ;; @0041 jump block1 ;; ;; block1: -;; @0041 return v11, v12 ; v11 = 0, v12 = 0 +;; @0041 return v7, v8 ; v7 = 0, v8 = 0 ;; } diff --git a/tests/disas/multi-4.wat b/tests/disas/multi-4.wat index 05ced50556f6..8a41154e9192 100644 --- a/tests/disas/multi-4.wat +++ b/tests/disas/multi-4.wat @@ -26,17 +26,17 @@ ;; @0037 brif v2, block2, block4 ;; ;; block2: -;; @0039 v9 = iadd.i64 v4, v3 -;; @003a v10 = iconst.i64 1 -;; @003c jump block3(v9, v10) ; v10 = 1 +;; @0039 v7 = iadd.i64 v4, v3 +;; @003a v8 = iconst.i64 1 +;; @003c jump block3(v7, v8) ; v8 = 1 ;; ;; block4: -;; @003d v13 = isub.i64 v4, v3 -;; @003e v14 = iconst.i64 2 -;; @0040 jump block3(v13, v14) ; v14 = 2 +;; @003d v9 = isub.i64 v4, v3 +;; @003e v10 = iconst.i64 2 +;; @0040 jump block3(v9, v10) ; v10 = 2 ;; -;; block3(v7: i64, v8: i64): -;; @0041 jump block1(v7, v8) +;; block3(v11: i64, v12: i64): +;; @0041 jump block1(v11, v12) ;; ;; block1(v5: i64, v6: i64): ;; @0041 return v5, v6 diff --git a/tests/disas/multi-6.wat b/tests/disas/multi-6.wat index 0e5479cbc5e4..f378d60dd5d8 100644 --- a/tests/disas/multi-6.wat +++ b/tests/disas/multi-6.wat @@ -22,7 +22,7 @@ ;; ;; block0(v0: i64, v1: i64): ;; @0026 v2 = iconst.i32 1 -;; @002a v5 = iconst.i64 2 +;; @002a v3 = iconst.i64 2 ;; @002c jump block2 ;; ;; block2: diff --git a/tests/disas/multi-7.wat b/tests/disas/multi-7.wat index c0b85c063572..8c0216fd6f80 100644 --- a/tests/disas/multi-7.wat +++ b/tests/disas/multi-7.wat @@ -22,11 +22,11 @@ ;; @002a brif v3, block2, block3(v2) ;; ;; block2: -;; @002d v6 = iconst.i64 -1 -;; @002f jump block3(v6) ; v6 = -1 +;; @002d v5 = iconst.i64 -1 +;; @002f jump block3(v5) ; v5 = -1 ;; -;; block3(v5: i64): -;; @0030 jump block1(v5) +;; block3(v6: i64): +;; @0030 jump block1(v6) ;; ;; block1(v4: i64): ;; @0030 return v4 diff --git a/tests/disas/multi-8.wat b/tests/disas/multi-8.wat index 0600909c4059..ff571bea7da0 100644 --- a/tests/disas/multi-8.wat +++ b/tests/disas/multi-8.wat @@ -25,15 +25,15 @@ ;; @002a brif v3, block2, block4 ;; ;; block2: -;; @002d v6 = iconst.i64 -1 -;; @002f jump block3(v6) ; v6 = -1 +;; @002d v5 = iconst.i64 -1 +;; @002f jump block3(v5) ; v5 = -1 ;; ;; block4: -;; @0031 v8 = iconst.i64 -2 -;; @0033 jump block3(v8) ; v8 = -2 +;; @0031 v6 = iconst.i64 -2 +;; @0033 jump block3(v6) ; v6 = -2 ;; -;; block3(v5: i64): -;; @0034 jump block1(v5) +;; block3(v7: i64): +;; @0034 jump block1(v7) ;; ;; block1(v4: i64): ;; @0034 return v4 diff --git a/tests/disas/multi-9.wat b/tests/disas/multi-9.wat index 58caed4daab2..58638965447e 100644 --- a/tests/disas/multi-9.wat +++ b/tests/disas/multi-9.wat @@ -28,15 +28,15 @@ ;; @0027 brif v3, block2, block4 ;; ;; block2: -;; @002b v8 = iconst.i64 -1 -;; @002d jump block3(v8) ; v8 = -1 +;; @002b v5 = iconst.i64 -1 +;; @002d jump block3(v5) ; v5 = -1 ;; ;; block4: -;; @0030 v9 = iconst.i64 -2 -;; @0032 jump block3(v9) ; v9 = -2 +;; @0030 v6 = iconst.i64 -2 +;; @0032 jump block3(v6) ; v6 = -2 ;; -;; block3(v5: i64): -;; @0033 jump block1(v5) +;; block3(v7: i64): +;; @0033 jump block1(v7) ;; ;; block1(v4: i64): ;; @0033 return v4 diff --git a/tests/disas/nullref.wat b/tests/disas/nullref.wat index dc09e898f378..bc801363a99c 100644 --- a/tests/disas/nullref.wat +++ b/tests/disas/nullref.wat @@ -37,12 +37,12 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0020 v4 = iconst.i32 0 +;; @0020 v3 = iconst.i32 0 ;; @0022 jump block2 ;; ;; block2: ;; @0023 jump block1 ;; ;; block1: -;; @0023 return v4 ; v4 = 0 +;; @0023 return v3 ; v3 = 0 ;; } diff --git a/tests/disas/pr2303.wat b/tests/disas/pr2303.wat index 3c852a98a729..ab5809db445b 100644 --- a/tests/disas/pr2303.wat +++ b/tests/disas/pr2303.wat @@ -42,37 +42,37 @@ ;; @0046 brif v2, block2, block4 ;; ;; block2: -;; @0048 v16 = bitcast.i64x2 little v8 -;; @0048 v17 = bitcast.i64x2 little v13 -;; @0048 v18 = iadd v16, v17 -;; @004b v19 = iconst.i32 32 -;; @004d v20 = uextend.i64 v19 ; v19 = 32 -;; @004d v21 = load.i64 notrap aligned readonly can_move region2 v0+56 -;; @004d v22 = iadd v21, v20 -;; @004d v23 = load.i8x16 little region4 v22 -;; @0051 v26 = bitcast.i8x16 little v18 -;; @0051 jump block3(v26, v23) +;; @0048 v14 = bitcast.i64x2 little v8 +;; @0048 v15 = bitcast.i64x2 little v13 +;; @0048 v16 = iadd v14, v15 +;; @004b v17 = iconst.i32 32 +;; @004d v18 = uextend.i64 v17 ; v17 = 32 +;; @004d v19 = load.i64 notrap aligned readonly can_move region2 v0+56 +;; @004d v20 = iadd v19, v18 +;; @004d v21 = load.i8x16 little region4 v20 +;; @0051 v22 = bitcast.i8x16 little v16 +;; @0051 jump block3(v22, v21) ;; ;; block4: -;; @0052 v27 = bitcast.i32x4 little v8 -;; @0052 v28 = bitcast.i32x4 little v13 -;; @0052 v29 = isub v27, v28 -;; @0055 v30 = iconst.i32 0 -;; @0057 v31 = uextend.i64 v30 ; v30 = 0 -;; @0057 v32 = load.i64 notrap aligned readonly can_move region2 v0+56 -;; @0057 v33 = iadd v32, v31 -;; @0057 v34 = load.i8x16 little region4 v33 -;; @005b v35 = bitcast.i8x16 little v29 -;; @005b jump block3(v35, v34) +;; @0052 v23 = bitcast.i32x4 little v8 +;; @0052 v24 = bitcast.i32x4 little v13 +;; @0052 v25 = isub v23, v24 +;; @0055 v26 = iconst.i32 0 +;; @0057 v27 = uextend.i64 v26 ; v26 = 0 +;; @0057 v28 = load.i64 notrap aligned readonly can_move region2 v0+56 +;; @0057 v29 = iadd v28, v27 +;; @0057 v30 = load.i8x16 little region4 v29 +;; @005b v31 = bitcast.i8x16 little v25 +;; @005b jump block3(v31, v30) ;; -;; block3(v14: i8x16, v15: i8x16): -;; @005c v36 = bitcast.i16x8 little v14 -;; @005c v37 = bitcast.i16x8 little v15 -;; @005c v38 = imul v36, v37 -;; @005f v39 = uextend.i64 v3 ; v3 = 48 -;; @005f v40 = load.i64 notrap aligned readonly can_move region2 v0+56 -;; @005f v41 = iadd v40, v39 -;; @005f store little region4 v38, v41 +;; block3(v32: i8x16, v33: i8x16): +;; @005c v34 = bitcast.i16x8 little v32 +;; @005c v35 = bitcast.i16x8 little v33 +;; @005c v36 = imul v34, v35 +;; @005f v37 = uextend.i64 v3 ; v3 = 48 +;; @005f v38 = load.i64 notrap aligned readonly can_move region2 v0+56 +;; @005f v39 = iadd v38, v37 +;; @005f store little region4 v36, v39 ;; @0063 jump block1 ;; ;; block1: diff --git a/tests/disas/simple.wat b/tests/disas/simple.wat index 304b3557b6a3..1e38998c9b9f 100644 --- a/tests/disas/simple.wat +++ b/tests/disas/simple.wat @@ -61,8 +61,8 @@ ;; @0030 v3 = iconst.i32 0 ;; @0032 jump block2(v3) ; v3 = 0 ;; -;; block2(v5: i32): -;; @0036 v6 = iconst.i32 1 -;; @0038 v7 = iadd v5, v6 ; v6 = 1 -;; @003b jump block2(v7) +;; block2(v4: i32): +;; @0036 v5 = iconst.i32 1 +;; @0038 v6 = iadd v4, v5 ; v5 = 1 +;; @003b jump block2(v6) ;; } diff --git a/tests/disas/stack-switching/resume-suspend-data-passing.wat b/tests/disas/stack-switching/resume-suspend-data-passing.wat index e20d8c86f356..2b6bab901080 100644 --- a/tests/disas/stack-switching/resume-suspend-data-passing.wat +++ b/tests/disas/stack-switching/resume-suspend-data-passing.wat @@ -169,145 +169,145 @@ ;; @0058 v7 = load.i64 notrap aligned v6+72 ;; @0058 v9 = uextend.i128 v7 ;; @0058 v10 = iconst.i64 64 -;; v117 = ishl v9, v10 ; v10 = 64 +;; v115 = ishl v9, v10 ; v10 = 64 ;; @0058 v8 = uextend.i128 v6 -;; @0058 v13 = bor v117, v8 -;; @0062 v24 = iconst.i64 1 -;; @0062 v27 = load.i64 notrap aligned readonly can_move region0 v0+8 -;; @0062 v30 = iconst.i64 0 -;; @0062 v31 = iconst.i64 2 -;; @0062 v35 = iconst.i32 1 -;; @0062 v36 = iconst.i64 16 -;; @0062 v38 = iconst.i32 2 -;; @0062 v50 = iconst.i64 24 -;; @0062 v53 = stack_addr.i64 ss0 -;; @0062 v54 = iconst.i64 48 -;; @0062 v55 = iadd v0, v54 ; v54 = 48 -;; @0062 v62 = iconst.i64 80 -;; @0062 v65 = iconst.i64 -24 -;; v121 = iconst.i64 0x0001_0000_0000 -;; @0062 v60 = iconst.i64 32 +;; @0058 v13 = bor v115, v8 +;; @0062 v22 = iconst.i64 1 +;; @0062 v25 = load.i64 notrap aligned readonly can_move region0 v0+8 +;; @0062 v28 = iconst.i64 0 +;; @0062 v29 = iconst.i64 2 +;; @0062 v33 = iconst.i32 1 +;; @0062 v34 = iconst.i64 16 +;; @0062 v36 = iconst.i32 2 +;; @0062 v48 = iconst.i64 24 +;; @0062 v51 = stack_addr.i64 ss0 +;; @0062 v52 = iconst.i64 48 +;; @0062 v53 = iadd v0, v52 ; v52 = 48 +;; @0062 v60 = iconst.i64 80 +;; @0062 v63 = iconst.i64 -24 +;; v119 = iconst.i64 0x0001_0000_0000 +;; @0062 v58 = iconst.i64 32 ;; @005c jump block2(v13) ;; -;; block2(v16: i128): +;; block2(v14: i128): ;; @0062 jump block5 ;; ;; block5: -;; @0062 v17 = ireduce.i64 v16 -;; @0062 trapz v17, user16 -;; @0062 v22 = load.i64 notrap aligned v17+72 -;; v124 = iconst.i64 64 -;; v125 = ushr.i128 v16, v124 ; v124 = 64 -;; @0062 v21 = ireduce.i64 v125 -;; @0062 v23 = icmp eq v22, v21 -;; @0062 trapz v23, user23 -;; v126 = iconst.i64 1 -;; v127 = iadd v22, v126 ; v126 = 1 -;; @0062 store notrap aligned v127, v17+72 -;; @0062 v26 = load.i64 notrap aligned v17+64 -;; @0062 v28 = load.i64 notrap aligned region2 v27+88 -;; @0062 v29 = load.i64 notrap aligned region2 v27+96 -;; @0062 store notrap aligned v28, v26+48 -;; @0062 store notrap aligned v29, v26+56 -;; v128 = iconst.i64 0 -;; @0062 store notrap aligned v128, v17+64 ; v128 = 0 -;; v129 = iconst.i64 2 -;; @0062 store notrap aligned region2 v129, v27+88 ; v129 = 2 -;; @0062 store notrap aligned region2 v17, v27+96 -;; v130 = iconst.i32 1 -;; v131 = iconst.i64 16 -;; v132 = iadd v17, v131 ; v131 = 16 -;; @0062 store notrap aligned v130, v132 ; v130 = 1 -;; v133 = iconst.i32 2 -;; v134 = iadd v29, v131 ; v131 = 16 -;; @0062 store notrap aligned v133, v134 ; v133 = 2 -;; @0062 v44 = load.i64 notrap aligned region3 v27+72 -;; @0062 store notrap aligned v44, v29+8 -;; @0062 v45 = load.i64 notrap aligned region1 v27+24 -;; @0062 store notrap aligned v45, v29 -;; @0062 v48 = load.i64 notrap aligned v17 -;; @0062 store notrap aligned region1 v48, v27+24 -;; @0062 v49 = load.i64 notrap aligned v17+8 -;; @0062 store notrap aligned region3 v49, v27+72 -;; v135 = iconst.i64 24 -;; v136 = iadd v29, v135 ; v135 = 24 -;; @0062 store notrap aligned v130, v136+4 ; v130 = 1 -;; @0062 store.i64 notrap aligned v53, v136+8 -;; v137 = iadd.i64 v0, v54 ; v54 = 48 -;; @0062 store notrap aligned v137, v53 -;; @0062 store notrap aligned v130, v136 ; v130 = 1 -;; @0062 store notrap aligned v130, v29+40 ; v130 = 1 -;; v138 = iconst.i64 80 -;; v139 = iadd v26, v138 ; v138 = 80 -;; @0062 v64 = load.i64 notrap aligned v139 -;; v140 = iconst.i64 -24 -;; v141 = iadd v64, v140 ; v140 = -24 -;; v142 = iconst.i64 0x0001_0000_0000 -;; @0062 v67 = stack_switch v141, v141, v142 ; v142 = 0x0001_0000_0000 -;; @0062 v69 = load.i64 notrap aligned region2 v27+88 -;; @0062 v70 = load.i64 notrap aligned region2 v27+96 -;; @0062 store notrap aligned region2 v28, v27+88 -;; @0062 store notrap aligned region2 v29, v27+96 -;; @0062 store notrap aligned v130, v134 ; v130 = 1 -;; v143 = iconst.i32 0 -;; @0062 store notrap aligned v143, v136 ; v143 = 0 -;; @0062 store notrap aligned v143, v136+4 ; v143 = 0 -;; @0062 store notrap aligned v128, v136+8 ; v128 = 0 -;; @0062 store notrap aligned v128, v29+40 ; v128 = 0 -;; v144 = iconst.i64 32 -;; v145 = ushr v67, v144 ; v144 = 32 -;; @0062 brif v145, block7, block6 +;; @0062 v15 = ireduce.i64 v14 +;; @0062 trapz v15, user16 +;; @0062 v20 = load.i64 notrap aligned v15+72 +;; v122 = iconst.i64 64 +;; v123 = ushr.i128 v14, v122 ; v122 = 64 +;; @0062 v19 = ireduce.i64 v123 +;; @0062 v21 = icmp eq v20, v19 +;; @0062 trapz v21, user23 +;; v124 = iconst.i64 1 +;; v125 = iadd v20, v124 ; v124 = 1 +;; @0062 store notrap aligned v125, v15+72 +;; @0062 v24 = load.i64 notrap aligned v15+64 +;; @0062 v26 = load.i64 notrap aligned region2 v25+88 +;; @0062 v27 = load.i64 notrap aligned region2 v25+96 +;; @0062 store notrap aligned v26, v24+48 +;; @0062 store notrap aligned v27, v24+56 +;; v126 = iconst.i64 0 +;; @0062 store notrap aligned v126, v15+64 ; v126 = 0 +;; v127 = iconst.i64 2 +;; @0062 store notrap aligned region2 v127, v25+88 ; v127 = 2 +;; @0062 store notrap aligned region2 v15, v25+96 +;; v128 = iconst.i32 1 +;; v129 = iconst.i64 16 +;; v130 = iadd v15, v129 ; v129 = 16 +;; @0062 store notrap aligned v128, v130 ; v128 = 1 +;; v131 = iconst.i32 2 +;; v132 = iadd v27, v129 ; v129 = 16 +;; @0062 store notrap aligned v131, v132 ; v131 = 2 +;; @0062 v42 = load.i64 notrap aligned region3 v25+72 +;; @0062 store notrap aligned v42, v27+8 +;; @0062 v43 = load.i64 notrap aligned region1 v25+24 +;; @0062 store notrap aligned v43, v27 +;; @0062 v46 = load.i64 notrap aligned v15 +;; @0062 store notrap aligned region1 v46, v25+24 +;; @0062 v47 = load.i64 notrap aligned v15+8 +;; @0062 store notrap aligned region3 v47, v25+72 +;; v133 = iconst.i64 24 +;; v134 = iadd v27, v133 ; v133 = 24 +;; @0062 store notrap aligned v128, v134+4 ; v128 = 1 +;; @0062 store.i64 notrap aligned v51, v134+8 +;; v135 = iadd.i64 v0, v52 ; v52 = 48 +;; @0062 store notrap aligned v135, v51 +;; @0062 store notrap aligned v128, v134 ; v128 = 1 +;; @0062 store notrap aligned v128, v27+40 ; v128 = 1 +;; v136 = iconst.i64 80 +;; v137 = iadd v24, v136 ; v136 = 80 +;; @0062 v62 = load.i64 notrap aligned v137 +;; v138 = iconst.i64 -24 +;; v139 = iadd v62, v138 ; v138 = -24 +;; v140 = iconst.i64 0x0001_0000_0000 +;; @0062 v65 = stack_switch v139, v139, v140 ; v140 = 0x0001_0000_0000 +;; @0062 v67 = load.i64 notrap aligned region2 v25+88 +;; @0062 v68 = load.i64 notrap aligned region2 v25+96 +;; @0062 store notrap aligned region2 v26, v25+88 +;; @0062 store notrap aligned region2 v27, v25+96 +;; @0062 store notrap aligned v128, v132 ; v128 = 1 +;; v141 = iconst.i32 0 +;; @0062 store notrap aligned v141, v134 ; v141 = 0 +;; @0062 store notrap aligned v141, v134+4 ; v141 = 0 +;; @0062 store notrap aligned v126, v134+8 ; v126 = 0 +;; @0062 store notrap aligned v126, v27+40 ; v126 = 0 +;; v142 = iconst.i64 32 +;; v143 = ushr v65, v142 ; v142 = 32 +;; @0062 brif v143, block7, block6 ;; ;; block7: -;; @0062 v84 = load.i64 notrap aligned region3 v27+72 -;; @0062 store notrap aligned v84, v70+8 -;; @0062 v87 = load.i64 notrap aligned v29 -;; @0062 store notrap aligned region1 v87, v27+24 -;; @0062 v88 = load.i64 notrap aligned v29+8 -;; @0062 store notrap aligned region3 v88, v27+72 -;; @0062 v90 = load.i64 notrap aligned v70+72 +;; @0062 v82 = load.i64 notrap aligned region3 v25+72 +;; @0062 store notrap aligned v82, v68+8 +;; @0062 v85 = load.i64 notrap aligned v27 +;; @0062 store notrap aligned region1 v85, v25+24 +;; @0062 v86 = load.i64 notrap aligned v27+8 +;; @0062 store notrap aligned region3 v86, v25+72 +;; @0062 v88 = load.i64 notrap aligned v68+72 ;; @0062 jump block8 ;; ;; block9 cold: ;; @0062 trap user12 ;; ;; block10: -;; @0062 v97 = iconst.i64 120 -;; @0062 v98 = iadd.i64 v70, v97 ; v97 = 120 -;; @0062 v99 = load.i64 notrap aligned v98+8 -;; @0062 v100 = load.i32 notrap aligned v99 -;; v150 = iconst.i32 0 -;; @0062 store notrap aligned v150, v98 ; v150 = 0 +;; @0062 v95 = iconst.i64 120 +;; @0062 v96 = iadd.i64 v68, v95 ; v95 = 120 +;; @0062 v97 = load.i64 notrap aligned v96+8 +;; @0062 v98 = load.i32 notrap aligned v97 +;; v148 = iconst.i32 0 +;; @0062 store notrap aligned v148, v96 ; v148 = 0 ;; @0062 jump block4 ;; ;; block8: -;; @0062 v89 = ireduce.i32 v67 -;; @0062 br_table v89, block9, [block10] +;; @0062 v87 = ireduce.i32 v65 +;; @0062 br_table v87, block9, [block10] ;; ;; block6: -;; @0062 v104 = load.i64 notrap aligned v29 -;; @0062 store notrap aligned region1 v104, v27+24 -;; @0062 v105 = load.i64 notrap aligned v29+8 -;; @0062 store notrap aligned region3 v105, v27+72 -;; @0062 v108 = iconst.i32 4 -;; v146 = iconst.i64 16 -;; v147 = iadd.i64 v70, v146 ; v146 = 16 -;; @0062 store notrap aligned v108, v147 ; v108 = 4 -;; @0062 v111 = iconst.i64 104 -;; @0062 v112 = iadd.i64 v70, v111 ; v111 = 104 -;; @0062 v113 = load.i64 notrap aligned v112+8 -;; v148 = iconst.i32 0 -;; @0062 store notrap aligned v148, v112 ; v148 = 0 -;; @0062 store notrap aligned v148, v112+4 ; v148 = 0 -;; v149 = iconst.i64 0 -;; @0062 store notrap aligned v149, v112+8 ; v149 = 0 +;; @0062 v102 = load.i64 notrap aligned v27 +;; @0062 store notrap aligned region1 v102, v25+24 +;; @0062 v103 = load.i64 notrap aligned v27+8 +;; @0062 store notrap aligned region3 v103, v25+72 +;; @0062 v106 = iconst.i32 4 +;; v144 = iconst.i64 16 +;; v145 = iadd.i64 v68, v144 ; v144 = 16 +;; @0062 store notrap aligned v106, v145 ; v106 = 4 +;; @0062 v109 = iconst.i64 104 +;; @0062 v110 = iadd.i64 v68, v109 ; v109 = 104 +;; @0062 v111 = load.i64 notrap aligned v110+8 +;; v146 = iconst.i32 0 +;; @0062 store notrap aligned v146, v110 ; v146 = 0 +;; @0062 store notrap aligned v146, v110+4 ; v146 = 0 +;; v147 = iconst.i64 0 +;; @0062 store notrap aligned v147, v110+8 ; v147 = 0 ;; @0068 return ;; ;; block4: -;; @0062 v92 = uextend.i128 v90 -;; v151 = iconst.i64 64 -;; v152 = ishl v92, v151 ; v151 = 64 -;; @0062 v91 = uextend.i128 v70 -;; @0062 v96 = bor v152, v91 -;; @006d jump block2(v96) +;; @0062 v90 = uextend.i128 v88 +;; v149 = iconst.i64 64 +;; v150 = ishl v90, v149 ; v149 = 64 +;; @0062 v89 = uextend.i128 v68 +;; @0062 v94 = bor v150, v89 +;; @006d jump block2(v94) ;; } diff --git a/tests/disas/stack-switching/resume-suspend.wat b/tests/disas/stack-switching/resume-suspend.wat index 648f513e39e5..c5eee27179b7 100644 --- a/tests/disas/stack-switching/resume-suspend.wat +++ b/tests/disas/stack-switching/resume-suspend.wat @@ -137,127 +137,127 @@ ;; v132 = ireduce.i64 v130 ;; v134 = bor v132, v13 ;; @004e trapz v134, user16 -;; @004e v27 = load.i64 notrap aligned v134+72 +;; @004e v26 = load.i64 notrap aligned v134+72 ;; @0045 v15 = uextend.i128 v13 ;; @0045 v20 = bor v130, v15 ;; v136 = ushr v20, v5 ; v5 = 64 -;; @004e v26 = ireduce.i64 v136 -;; @004e v28 = icmp eq v27, v26 -;; @004e trapz v28, user23 -;; @004e v29 = iconst.i64 1 -;; @004e v30 = iadd v27, v29 ; v29 = 1 -;; @004e store notrap aligned v30, v134+72 -;; @004e v31 = load.i64 notrap aligned v134+64 -;; @004e v32 = load.i64 notrap aligned readonly can_move region0 v0+8 -;; @004e v33 = load.i64 notrap aligned region2 v32+88 -;; @004e v34 = load.i64 notrap aligned region2 v32+96 -;; @004e store notrap aligned v33, v31+48 -;; @004e store notrap aligned v34, v31+56 +;; @004e v25 = ireduce.i64 v136 +;; @004e v27 = icmp eq v26, v25 +;; @004e trapz v27, user23 +;; @004e v28 = iconst.i64 1 +;; @004e v29 = iadd v26, v28 ; v28 = 1 +;; @004e store notrap aligned v29, v134+72 +;; @004e v30 = load.i64 notrap aligned v134+64 +;; @004e v31 = load.i64 notrap aligned readonly can_move region0 v0+8 +;; @004e v32 = load.i64 notrap aligned region2 v31+88 +;; @004e v33 = load.i64 notrap aligned region2 v31+96 +;; @004e store notrap aligned v32, v30+48 +;; @004e store notrap aligned v33, v30+56 ;; @0040 v2 = iconst.i64 0 ;; @004e store notrap aligned v2, v134+64 ; v2 = 0 -;; @004e v36 = iconst.i64 2 -;; @004e store notrap aligned region2 v36, v32+88 ; v36 = 2 -;; @004e store notrap aligned region2 v134, v32+96 -;; @004e v40 = iconst.i32 1 -;; @004e v41 = iconst.i64 16 -;; @004e v42 = iadd v134, v41 ; v41 = 16 -;; @004e store notrap aligned v40, v42 ; v40 = 1 -;; @004e v43 = iconst.i32 2 -;; @004e v45 = iadd v34, v41 ; v41 = 16 -;; @004e store notrap aligned v43, v45 ; v43 = 2 -;; @004e v49 = load.i64 notrap aligned region3 v32+72 -;; @004e store notrap aligned v49, v34+8 -;; @004e v50 = load.i64 notrap aligned region1 v32+24 -;; @004e store notrap aligned v50, v34 -;; @004e v53 = load.i64 notrap aligned v134 -;; @004e store notrap aligned region1 v53, v32+24 -;; @004e v54 = load.i64 notrap aligned v134+8 -;; @004e store notrap aligned region3 v54, v32+72 -;; @004e v55 = iconst.i64 24 -;; @004e v56 = iadd v34, v55 ; v55 = 24 -;; @004e store notrap aligned v40, v56+4 ; v40 = 1 -;; @004e v58 = stack_addr.i64 ss0 -;; @004e store notrap aligned v58, v56+8 -;; @004e v59 = iconst.i64 48 -;; @004e v60 = iadd.i64 v0, v59 ; v59 = 48 -;; @004e store notrap aligned v60, v58 -;; @004e store notrap aligned v40, v56 ; v40 = 1 -;; @004e store notrap aligned v40, v34+40 ; v40 = 1 -;; @004e v67 = iconst.i64 80 -;; @004e v68 = iadd v31, v67 ; v67 = 80 -;; @004e v69 = load.i64 notrap aligned v68 -;; @004e v70 = iconst.i64 -24 -;; @004e v71 = iadd v69, v70 ; v70 = -24 +;; @004e v35 = iconst.i64 2 +;; @004e store notrap aligned region2 v35, v31+88 ; v35 = 2 +;; @004e store notrap aligned region2 v134, v31+96 +;; @004e v39 = iconst.i32 1 +;; @004e v40 = iconst.i64 16 +;; @004e v41 = iadd v134, v40 ; v40 = 16 +;; @004e store notrap aligned v39, v41 ; v39 = 1 +;; @004e v42 = iconst.i32 2 +;; @004e v44 = iadd v33, v40 ; v40 = 16 +;; @004e store notrap aligned v42, v44 ; v42 = 2 +;; @004e v48 = load.i64 notrap aligned region3 v31+72 +;; @004e store notrap aligned v48, v33+8 +;; @004e v49 = load.i64 notrap aligned region1 v31+24 +;; @004e store notrap aligned v49, v33 +;; @004e v52 = load.i64 notrap aligned v134 +;; @004e store notrap aligned region1 v52, v31+24 +;; @004e v53 = load.i64 notrap aligned v134+8 +;; @004e store notrap aligned region3 v53, v31+72 +;; @004e v54 = iconst.i64 24 +;; @004e v55 = iadd v33, v54 ; v54 = 24 +;; @004e store notrap aligned v39, v55+4 ; v39 = 1 +;; @004e v57 = stack_addr.i64 ss0 +;; @004e store notrap aligned v57, v55+8 +;; @004e v58 = iconst.i64 48 +;; @004e v59 = iadd.i64 v0, v58 ; v58 = 48 +;; @004e store notrap aligned v59, v57 +;; @004e store notrap aligned v39, v55 ; v39 = 1 +;; @004e store notrap aligned v39, v33+40 ; v39 = 1 +;; @004e v66 = iconst.i64 80 +;; @004e v67 = iadd v30, v66 ; v66 = 80 +;; @004e v68 = load.i64 notrap aligned v67 +;; @004e v69 = iconst.i64 -24 +;; @004e v70 = iadd v68, v69 ; v69 = -24 ;; v138 = iconst.i64 0x0001_0000_0000 -;; @004e v72 = stack_switch v71, v71, v138 ; v138 = 0x0001_0000_0000 -;; @004e v74 = load.i64 notrap aligned region2 v32+88 -;; @004e v75 = load.i64 notrap aligned region2 v32+96 -;; @004e store notrap aligned region2 v33, v32+88 -;; @004e store notrap aligned region2 v34, v32+96 -;; @004e store notrap aligned v40, v45 ; v40 = 1 +;; @004e v71 = stack_switch v70, v70, v138 ; v138 = 0x0001_0000_0000 +;; @004e v73 = load.i64 notrap aligned region2 v31+88 +;; @004e v74 = load.i64 notrap aligned region2 v31+96 +;; @004e store notrap aligned region2 v32, v31+88 +;; @004e store notrap aligned region2 v33, v31+96 +;; @004e store notrap aligned v39, v44 ; v39 = 1 ;; v141 = iconst.i32 0 -;; @004e store notrap aligned v141, v56 ; v141 = 0 -;; @004e store notrap aligned v141, v56+4 ; v141 = 0 -;; @004e store notrap aligned v2, v56+8 ; v2 = 0 -;; @004e store notrap aligned v2, v34+40 ; v2 = 0 -;; @004e v65 = iconst.i64 32 -;; @004e v84 = ushr v72, v65 ; v65 = 32 -;; @004e brif v84, block5, block4 +;; @004e store notrap aligned v141, v55 ; v141 = 0 +;; @004e store notrap aligned v141, v55+4 ; v141 = 0 +;; @004e store notrap aligned v2, v55+8 ; v2 = 0 +;; @004e store notrap aligned v2, v33+40 ; v2 = 0 +;; @004e v64 = iconst.i64 32 +;; @004e v83 = ushr v71, v64 ; v64 = 32 +;; @004e brif v83, block5, block4 ;; ;; block5: -;; @004e v89 = load.i64 notrap aligned region3 v32+72 -;; @004e store notrap aligned v89, v75+8 -;; @004e v92 = load.i64 notrap aligned v34 -;; @004e store notrap aligned region1 v92, v32+24 -;; @004e v93 = load.i64 notrap aligned v34+8 -;; @004e store notrap aligned region3 v93, v32+72 -;; @004e v95 = load.i64 notrap aligned v75+72 +;; @004e v88 = load.i64 notrap aligned region3 v31+72 +;; @004e store notrap aligned v88, v74+8 +;; @004e v91 = load.i64 notrap aligned v33 +;; @004e store notrap aligned region1 v91, v31+24 +;; @004e v92 = load.i64 notrap aligned v33+8 +;; @004e store notrap aligned region3 v92, v31+72 +;; @004e v94 = load.i64 notrap aligned v74+72 ;; @004e jump block6 ;; ;; block7 cold: ;; @004e trap user12 ;; ;; block8: -;; @004e v102 = iconst.i64 120 -;; @004e v103 = iadd.i64 v75, v102 ; v102 = 120 -;; @004e v104 = load.i64 notrap aligned v103+8 +;; @004e v101 = iconst.i64 120 +;; @004e v102 = iadd.i64 v74, v101 ; v101 = 120 +;; @004e v103 = load.i64 notrap aligned v102+8 ;; v149 = iconst.i32 0 -;; @004e store notrap aligned v149, v103 ; v149 = 0 -;; @004e v97 = uextend.i128 v95 +;; @004e store notrap aligned v149, v102 ; v149 = 0 +;; @004e v96 = uextend.i128 v94 ;; v150 = iconst.i64 64 -;; v151 = ishl v97, v150 ; v150 = 64 -;; @004e v96 = uextend.i128 v75 -;; @004e v101 = bor v151, v96 -;; @004e jump block2(v101) +;; v151 = ishl v96, v150 ; v150 = 64 +;; @004e v95 = uextend.i128 v74 +;; @004e v100 = bor v151, v95 +;; @004e jump block2(v100) ;; ;; block6: -;; @004e v94 = ireduce.i32 v72 -;; @004e br_table v94, block7, [block8] +;; @004e v93 = ireduce.i32 v71 +;; @004e br_table v93, block7, [block8] ;; ;; block4: -;; @004e v108 = load.i64 notrap aligned v34 -;; @004e store notrap aligned region1 v108, v32+24 -;; @004e v109 = load.i64 notrap aligned v34+8 -;; @004e store notrap aligned region3 v109, v32+72 -;; @004e v112 = iconst.i32 4 +;; @004e v107 = load.i64 notrap aligned v33 +;; @004e store notrap aligned region1 v107, v31+24 +;; @004e v108 = load.i64 notrap aligned v33+8 +;; @004e store notrap aligned region3 v108, v31+72 +;; @004e v111 = iconst.i32 4 ;; v142 = iconst.i64 16 -;; v143 = iadd.i64 v75, v142 ; v142 = 16 -;; @004e store notrap aligned v112, v143 ; v112 = 4 -;; @004e v115 = iconst.i64 104 -;; @004e v116 = iadd.i64 v75, v115 ; v115 = 104 -;; @004e v117 = load.i64 notrap aligned v116+8 +;; v143 = iadd.i64 v74, v142 ; v142 = 16 +;; @004e store notrap aligned v111, v143 ; v111 = 4 +;; @004e v114 = iconst.i64 104 +;; @004e v115 = iadd.i64 v74, v114 ; v114 = 104 +;; @004e v116 = load.i64 notrap aligned v115+8 ;; v144 = iconst.i32 0 -;; @004e store notrap aligned v144, v116 ; v144 = 0 -;; @004e store notrap aligned v144, v116+4 ; v144 = 0 +;; @004e store notrap aligned v144, v115 ; v144 = 0 +;; @004e store notrap aligned v144, v115+4 ; v144 = 0 ;; v145 = iconst.i64 0 -;; @004e store notrap aligned v145, v116+8 ; v145 = 0 +;; @004e store notrap aligned v145, v115+8 ; v145 = 0 ;; v146 = uextend.i128 v145 ; v145 = 0 ;; v147 = iconst.i64 64 ;; v148 = ishl v146, v147 ; v147 = 64 ;; @0040 v8 = bor v148, v146 ;; @0056 jump block2(v8) ;; -;; block2(v21: i128): +;; block2(v127: i128): ;; @0058 jump block1 ;; ;; block1: diff --git a/tests/disas/unreachable_code.wat b/tests/disas/unreachable_code.wat index 8c7f45a542dd..39d48f57ec48 100644 --- a/tests/disas/unreachable_code.wat +++ b/tests/disas/unreachable_code.wat @@ -114,8 +114,8 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0061 v4 = iconst.i32 1 -;; @0063 brif v4, block6, block13 ; v4 = 1 +;; @0061 v3 = iconst.i32 1 +;; @0063 brif v3, block6, block13 ; v3 = 1 ;; ;; block6: ;; @006a jump block9 @@ -148,7 +148,7 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0095 v4 = iconst.i32 1 +;; @0095 v2 = iconst.i32 1 ;; @0097 jump block2 ;; ;; block2: