A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Allow CLIF frontends to tag stack map loads/stores with alias regions (#13764)
Nick Fitzgerald1e347859e47a
diff --git a/cranelift/frontend/src/frontend.rs b/cranelift/frontend/src/frontend.rsindex 59df86cb82..195de37b8c 100644--- a/cranelift/frontend/src/frontend.rs+++ b/cranelift/frontend/src/frontend.rs@@ -1,7 +1,7 @@//! A frontend for building Cranelift IR from other languages.use crate::ssa::{SSABuilder, SideEffects};use crate::variable::Variable;-use alloc::{vec, vec::Vec};+use alloc::{boxed::Box, vec, vec::Vec};use core::fmt::{self, Debug};use cranelift_codegen::cursor::{Cursor, CursorPosition, FuncCursor};use cranelift_codegen::entity::{EntityRef, EntitySet, PrimaryMap, SecondaryMap};@@ -76,6 +76,7 @@ impl FunctionBuilderContext {status.clear();variables.clear();safepoints.clear();+ safepoints.make_alias_region = None;}fn is_empty(&self) -> bool {@@ -677,6 +678,25 @@ impl<'a> FunctionBuilder<'a> {}}+ /// Configure a callback that assigns an alias region to the loads and+ /// stores inserted when spilling and reloading values that are live across+ /// safepoints.+ ///+ /// The callback is given the function's [`ir::AliasRegionSet`] (so it can+ /// intern a region), along with the type, stack slot, and offset of the+ /// spill/reload being emitted, and returns the alias region to attach to+ /// that load or store (or `None` to leave it unannotated).+ pub fn make_stack_map_alias_region(+ &mut self,+ make_alias_region: Box<+ dyn Fn(&mut ir::AliasRegionSet, ir::Type, ir::StackSlot, u32) -> Option<ir::AliasRegion>+ + Send+ + Sync,+ >,+ ) {+ self.func_ctx.safepoints.make_alias_region = Some(make_alias_region);+ }+/// Declare that translation of the current function is complete.////// This resets the state of the [`FunctionBuilderContext`] in preparation todiff --git a/cranelift/frontend/src/frontend/safepoints.rs b/cranelift/frontend/src/frontend/safepoints.rsindex e10d84a1c5..d0250a042e 100644--- a/cranelift/frontend/src/frontend/safepoints.rs+++ b/cranelift/frontend/src/frontend/safepoints.rs@@ -606,6 +606,17 @@ impl StackSlots {pub(super) struct SafepointSpiller {liveness: LivenessAnalysis,stack_slots: StackSlots,++ /// Optional embedder callback used to assign an alias region to the loads+ /// and stores emitted when spilling and reloading values that are live+ /// across safepoints.+ pub(super) make_alias_region: Option<+ Box<+ dyn Fn(&mut ir::AliasRegionSet, ir::Type, ir::StackSlot, u32) -> Option<ir::AliasRegion>+ + Send+ + Sync,+ >,+ >,}impl SafepointSpiller {@@ -615,6 +626,7 @@ impl SafepointSpiller {let SafepointSpiller {liveness,stack_slots,+ make_alias_region: _,} = self;liveness.clear();stack_slots.clear();@@ -652,15 +664,27 @@ impl SafepointSpiller {fn rewrite_def(&mut self, pos: &mut FuncCursor<'_>, val: ir::Value, pointer_type: ir::Type) {debug_assert!(!pos.func.dfg.value_is_alias(val));if let Some(slot) = self.stack_slots.get(val) {- let i = pos.ins().stack_store(pointer_type, val, slot, 0);+ let ty = pos.func.dfg.value_type(val);++ let mut flags = ir::MemFlagsData::trusted();+ flags.set_notrap();+ if let Some(make_alias_region) = &self.make_alias_region {+ if let Some(region) =+ make_alias_region(&mut pos.func.dfg.alias_regions, ty, slot, 0)+ {+ flags.set_alias_region(Some(region));+ }+ }++ let addr = pos.ins().stack_addr(pointer_type, slot, 0);+ let inst = pos.ins().store(flags, val, addr, 0);log::trace!("rewriting: spilling {val:?} to {slot:?}: {}",- pos.func.dfg.display_inst(i)+ pos.func.dfg.display_inst(inst));// Now that we've defined this value, there cannot be any more uses// of it, and therefore this stack slot is now available for reuse.- let ty = pos.func.dfg.value_type(val);let size = SlotSize::try_from(ty).unwrap();self.stack_slots.free_stack_slot(size, slot);}@@ -729,7 +753,17 @@ impl SafepointSpiller {let ty = pos.func.dfg.value_type(*val);let slot = self.stack_slots.get_or_create_stack_slot(pos.func, *val);- *val = pos.ins().stack_load(pointer_type, ty, slot, 0);++ let mut flags = ir::MemFlagsData::trusted();+ flags.set_notrap();+ if let Some(make_alias_region) = &self.make_alias_region {+ if let Some(region) = make_alias_region(&mut pos.func.dfg.alias_regions, ty, slot, 0) {+ flags.set_alias_region(Some(region));+ }+ }++ let addr = pos.ins().stack_addr(pointer_type, slot, 0);+ *val = pos.ins().load(ty, flags, addr, 0);log::trace!("rewriting: reloading {old_val:?}: {}",@@ -907,16 +941,16 @@ function %sample(i32, i32) system_v {block0(v0: i32, v1: i32):v8 = stack_addr.i64 ss0- store notrap v0, v8+ store notrap aligned v0, v8v9 = stack_addr.i64 ss1- store notrap v1, v9+ store notrap aligned v1, v9v6 = stack_addr.i64 ss0- v7 = load.i32 notrap v6+ v7 = load.i32 notrap aligned v6call fn0(v7), stack_map=[i32 @ ss0+0, i32 @ ss1+0]v2 = stack_addr.i64 ss0- v3 = load.i32 notrap v2+ v3 = load.i32 notrap aligned v2v4 = stack_addr.i64 ss1- v5 = load.i32 notrap v4+ v5 = load.i32 notrap aligned v4jump block0(v3, v5)}"#@@ -999,23 +1033,23 @@ function %sample() system_v {block0:v0 = iconst.i32 0v12 = stack_addr.i64 ss2- store notrap v0, v12 ; v0 = 0+ store notrap aligned v0, v12 ; v0 = 0v1 = iconst.i32 1v11 = stack_addr.i64 ss1- store notrap v1, v11 ; v1 = 1+ store notrap aligned v1, v11 ; v1 = 1v2 = iconst.i32 2v10 = stack_addr.i64 ss0- store notrap v2, v10 ; v2 = 2+ store notrap aligned v2, v10 ; v2 = 2v3 = iconst.i32 3call fn0(v3), stack_map=[i32 @ ss2+0, i32 @ ss1+0, i32 @ ss0+0] ; v3 = 3v8 = stack_addr.i64 ss2- v9 = load.i32 notrap v8+ v9 = load.i32 notrap aligned v8call fn0(v9), stack_map=[i32 @ ss1+0, i32 @ ss0+0]v6 = stack_addr.i64 ss1- v7 = load.i32 notrap v6+ v7 = load.i32 notrap aligned v6call fn0(v7), stack_map=[i32 @ ss0+0]v4 = stack_addr.i64 ss0- v5 = load.i32 notrap v4+ v5 = load.i32 notrap aligned v4call fn0(v5)return}@@ -1548,34 +1582,34 @@ block0(v0: i32):block1:v1 = iconst.i64 1v16 = stack_addr.i64 ss0- store notrap v1, v16 ; v1 = 1+ store notrap aligned v1, v16 ; v1 = 1v2 = iconst.i64 2v15 = stack_addr.i64 ss1- store notrap v2, v15 ; v2 = 2+ store notrap aligned v2, v15 ; v2 = 2call fn0(), stack_map=[i64 @ ss0+0, i64 @ ss1+0]v11 = stack_addr.i64 ss0- v12 = load.i64 notrap v11+ v12 = load.i64 notrap aligned v11v13 = stack_addr.i64 ss1- v14 = load.i64 notrap v13+ v14 = load.i64 notrap aligned v13jump block3(v12, v14)block2:v3 = iconst.i64 3v21 = stack_addr.i64 ss0- store notrap v3, v21 ; v3 = 3+ store notrap aligned v3, v21 ; v3 = 3v4 = iconst.i64 4call fn0(), stack_map=[i64 @ ss0+0, i64 @ ss0+0]v17 = stack_addr.i64 ss0- v18 = load.i64 notrap v17+ v18 = load.i64 notrap aligned v17v19 = stack_addr.i64 ss0- v20 = load.i64 notrap v19+ v20 = load.i64 notrap aligned v19jump block3(v18, v20)block3(v5: i64, v6: i64):call fn0(), stack_map=[i64 @ ss0+0]v7 = iconst.i64 0v9 = stack_addr.i64 ss0- v10 = load.i64 notrap v9+ v10 = load.i64 notrap aligned v9v8 = iadd v10, v7 ; v7 = 0return}@@ -1661,42 +1695,42 @@ function %sample(i8, i16, i32, i64, i128, f32, f64, i8x16, i16x8) -> i8, i16, i3block0(v0: i8, v1: i16, v2: i32, v3: i64, v4: i128, v5: f32, v6: f64, v7: i8x16, v8: i16x8):v27 = stack_addr.i64 ss0- store notrap v0, v27+ store notrap aligned v0, v27v28 = stack_addr.i64 ss1- store notrap v1, v28+ store notrap aligned v1, v28v29 = stack_addr.i64 ss2- store notrap v2, v29+ store notrap aligned v2, v29v30 = stack_addr.i64 ss3- store notrap v3, v30+ store notrap aligned v3, v30v31 = stack_addr.i64 ss4- store notrap v4, v31+ store notrap aligned v4, v31v32 = stack_addr.i64 ss5- store notrap v5, v32+ store notrap aligned v5, v32v33 = stack_addr.i64 ss6- store notrap v6, v33+ store notrap aligned v6, v33v34 = stack_addr.i64 ss7- store notrap v7, v34+ store notrap aligned v7, v34v35 = stack_addr.i64 ss8- store notrap v8, v35+ store notrap aligned v8, v35call fn0(), stack_map=[i8 @ ss0+0, i16 @ ss1+0, i32 @ ss2+0, i64 @ ss3+0, i128 @ ss4+0, f32 @ ss5+0, f64 @ ss6+0, i8x16 @ ss7+0, i16x8 @ ss8+0]v9 = stack_addr.i64 ss0- v10 = load.i8 notrap v9+ v10 = load.i8 notrap aligned v9v11 = stack_addr.i64 ss1- v12 = load.i16 notrap v11+ v12 = load.i16 notrap aligned v11v13 = stack_addr.i64 ss2- v14 = load.i32 notrap v13+ v14 = load.i32 notrap aligned v13v15 = stack_addr.i64 ss3- v16 = load.i64 notrap v15+ v16 = load.i64 notrap aligned v15v17 = stack_addr.i64 ss4- v18 = load.i128 notrap v17+ v18 = load.i128 notrap aligned v17v19 = stack_addr.i64 ss5- v20 = load.f32 notrap v19+ v20 = load.f32 notrap aligned v19v21 = stack_addr.i64 ss6- v22 = load.f64 notrap v21+ v22 = load.f64 notrap aligned v21v23 = stack_addr.i64 ss7- v24 = load.i8x16 notrap v23+ v24 = load.i8x16 notrap aligned v23v25 = stack_addr.i64 ss8- v26 = load.i16x8 notrap v25+ v26 = load.i16x8 notrap aligned v25return v10, v12, v14, v16, v18, v20, v22, v24, v26}"#@@ -1797,31 +1831,31 @@ function %sample() system_v {block0:v0 = iconst.i32 0v15 = stack_addr.i64 ss0- store notrap v0, v15 ; v0 = 0+ store notrap aligned v0, v15 ; v0 = 0call fn0(), stack_map=[i32 @ ss0+0]v13 = stack_addr.i64 ss0- v14 = load.i32 notrap v13+ v14 = load.i32 notrap aligned v13call fn1(v14)v1 = iconst.i32 1v12 = stack_addr.i64 ss0- store notrap v1, v12 ; v1 = 1+ store notrap aligned v1, v12 ; v1 = 1call fn0(), stack_map=[i32 @ ss0+0]v10 = stack_addr.i64 ss0- v11 = load.i32 notrap v10+ v11 = load.i32 notrap aligned v10call fn1(v11)v2 = iconst.i32 2v9 = stack_addr.i64 ss0- store notrap v2, v9 ; v2 = 2+ store notrap aligned v2, v9 ; v2 = 2call fn0(), stack_map=[i32 @ ss0+0]v7 = stack_addr.i64 ss0- v8 = load.i32 notrap v7+ v8 = load.i32 notrap aligned v7call fn1(v8)v3 = iconst.i32 3v6 = stack_addr.i64 ss0- store notrap v3, v6 ; v3 = 3+ store notrap aligned v3, v6 ; v3 = 3call fn0(), stack_map=[i32 @ ss0+0]v4 = stack_addr.i64 ss0- v5 = load.i32 notrap v4+ v5 = load.i32 notrap aligned v4call fn1(v5)return}@@ -1950,54 +1984,54 @@ block0(v0: i32):v2 -> v1v4 -> v1v32 = stack_addr.i64 ss0- store notrap v1, v32 ; v1 = 42+ store notrap aligned v1, v32 ; v1 = 42v30 = stack_addr.i64 ss0- v31 = load.i32 notrap v30+ v31 = load.i32 notrap aligned v30call fn0(v31), stack_map=[i32 @ ss0+0]brif v0, block1, block2block1:v19 = stack_addr.i64 ss0- v20 = load.i32 notrap v19+ v20 = load.i32 notrap aligned v19call fn0(v20), stack_map=[i32 @ ss0+0]v17 = stack_addr.i64 ss0- v18 = load.i32 notrap v17+ v18 = load.i32 notrap aligned v17call fn0(v18)v3 = iconst.i32 36v16 = stack_addr.i64 ss0- store notrap v3, v16 ; v3 = 36+ store notrap aligned v3, v16 ; v3 = 36v14 = stack_addr.i64 ss0- v15 = load.i32 notrap v14+ v15 = load.i32 notrap aligned v14call fn0(v15), stack_map=[i32 @ ss0+0]v12 = stack_addr.i64 ss0- v13 = load.i32 notrap v12+ v13 = load.i32 notrap aligned v12jump block3(v13)block2:v28 = stack_addr.i64 ss0- v29 = load.i32 notrap v28+ v29 = load.i32 notrap aligned v28call fn0(v29), stack_map=[i32 @ ss0+0]v26 = stack_addr.i64 ss0- v27 = load.i32 notrap v26+ v27 = load.i32 notrap aligned v26call fn0(v27)v5 = iconst.i32 36v25 = stack_addr.i64 ss1- store notrap v5, v25 ; v5 = 36+ store notrap aligned v5, v25 ; v5 = 36v23 = stack_addr.i64 ss1- v24 = load.i32 notrap v23+ v24 = load.i32 notrap aligned v23call fn0(v24), stack_map=[i32 @ ss1+0]v21 = stack_addr.i64 ss1- v22 = load.i32 notrap v21+ v22 = load.i32 notrap aligned v21jump block3(v22)block3(v6: i32):v11 = stack_addr.i64 ss0- store notrap v6, v11+ store notrap aligned v6, v11v9 = stack_addr.i64 ss0- v10 = load.i32 notrap v9+ v10 = load.i32 notrap aligned v9call fn0(v10), stack_map=[i32 @ ss0+0]v7 = stack_addr.i64 ss0- v8 = load.i32 notrap v7+ v8 = load.i32 notrap aligned v7return v8}"#@@ -2060,10 +2094,10 @@ function %sample(i32) -> i32 system_v {block0(v0: i32):v3 = stack_addr.i64 ss0- store notrap v0, v3+ store notrap aligned v0, v3call fn0(), stack_map=[i32 @ ss0+0]v1 = stack_addr.i64 ss0- v2 = load.i32 notrap v1+ v2 = load.i32 notrap aligned v1return v2}"#@@ -2139,15 +2173,15 @@ function %sample(i32) -> i32, i32 system_v {block0(v0: i32):v7 = stack_addr.i64 ss0- store notrap v0, v7+ store notrap aligned v0, v7v1 = iconst.i32 42v6 = stack_addr.i64 ss1- store notrap v1, v6 ; v1 = 42+ store notrap aligned v1, v6 ; v1 = 42call fn0(), stack_map=[i32 @ ss0+0, i32 @ ss1+0]v2 = stack_addr.i64 ss0- v3 = load.i32 notrap v2+ v3 = load.i32 notrap aligned v2v4 = stack_addr.i64 ss1- v5 = load.i32 notrap v4+ v5 = load.i32 notrap aligned v4return v3, v5}"#@@ -2242,13 +2276,13 @@ function %sample(i32) system_v {block0(v0: i32):v3 = stack_addr.i64 ss0- store notrap v0, v3+ store notrap aligned v0, v3jump block1block1:call fn0(), stack_map=[i32 @ ss0+0]v1 = stack_addr.i64 ss0- v2 = load.i32 notrap v1+ v2 = load.i32 notrap aligned v1call fn1(v2), stack_map=[i32 @ ss0+0]call fn0(), stack_map=[i32 @ ss0+0]jump block1@@ -2370,7 +2404,7 @@ function %sample(i32, i32) system_v {block0(v0: i32, v1: i32):v6 = stack_addr.i64 ss0- store notrap v1, v6+ store notrap aligned v1, v6brif v0, block1, block2block1:@@ -2382,7 +2416,7 @@ block2:block3:call fn0(), stack_map=[i32 @ ss0+0]v4 = stack_addr.i64 ss0- v5 = load.i32 notrap v4+ v5 = load.i32 notrap aligned v4call fn1(v5), stack_map=[i32 @ ss0+0]call fn0(), stack_map=[i32 @ ss0+0]jump block2@@ -2390,7 +2424,7 @@ block3:block4:call fn0(), stack_map=[i32 @ ss0+0]v2 = stack_addr.i64 ss0- v3 = load.i32 notrap v2+ v3 = load.i32 notrap aligned v2call fn1(v3), stack_map=[i32 @ ss0+0]call fn0(), stack_map=[i32 @ ss0+0]jump block1@@ -2527,17 +2561,17 @@ function %sample(i32, i32, i32, i32) system_v {block0(v0: i32, v1: i32, v2: i32, v3: i32):v13 = stack_addr.i64 ss0- store notrap v0, v13+ store notrap aligned v0, v13v14 = stack_addr.i64 ss1- store notrap v1, v14+ store notrap aligned v1, v14v15 = stack_addr.i64 ss2- store notrap v2, v15+ store notrap aligned v2, v15jump block1(v3)block1(v4: i32):call fn0(), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]v11 = stack_addr.i64 ss0- v12 = load.i32 notrap v11+ v12 = load.i32 notrap aligned v11call fn1(v12), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]call fn0(), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]jump block2@@ -2545,7 +2579,7 @@ block1(v4: i32):block2:call fn0(), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]v9 = stack_addr.i64 ss1- v10 = load.i32 notrap v9+ v10 = load.i32 notrap aligned v9call fn1(v10), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]call fn0(), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]v5 = iconst.i32 -1@@ -2555,7 +2589,7 @@ block2:block3:call fn0(), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]v7 = stack_addr.i64 ss2- v8 = load.i32 notrap v7+ v8 = load.i32 notrap aligned v7call fn1(v8), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]call fn0(), stack_map=[i32 @ ss0+0, i32 @ ss1+0, i32 @ ss2+0]jump block2@@ -2852,12 +2886,12 @@ block0:block1(v22: i32):v21 -> v22v44 = stack_addr.i64 ss1- store notrap v22, v44+ store notrap aligned v22, v44v1 = call fn1(), stack_map=[i32 @ ss1+0]v8 -> v1v18 -> v1v43 = stack_addr.i64 ss0- store notrap v1, v43+ store notrap aligned v1, v43v2 = iconst.i32 0jump block2(v2) ; v2 = 0@@ -2868,7 +2902,7 @@ block2(v3: i32):block3:v24 = stack_addr.i64 ss0- v25 = load.i32 notrap v24+ v25 = load.i32 notrap aligned v24call fn2(v25, v4), stack_map=[i32 @ ss0+0, i32 @ ss1+0] ; v4 = 1v6 = iconst.i32 1v7 = iadd.i32 v4, v6 ; v4 = 1, v6 = 1@@ -2876,22 +2910,22 @@ block3:block4:v41 = stack_addr.i64 ss1- v42 = load.i32 notrap v41+ v42 = load.i32 notrap aligned v41jump block5(v42)block5(v20: i32):v19 -> v20v40 = stack_addr.i64 ss2- store notrap v20, v40+ store notrap aligned v20, v40v9 = iconst.i32 0v38 = stack_addr.i64 ss0- v39 = load.i32 notrap v38+ v39 = load.i32 notrap aligned v38v10 = icmp eq v39, v9 ; v9 = 0brif v10, block8(v9), block6 ; v9 = 0block6:v36 = stack_addr.i64 ss0- v37 = load.i32 notrap v36+ v37 = load.i32 notrap aligned v36v11 = call fn3(v37), stack_map=[i32 @ ss0+0, i32 @ ss2+0]v12 = iconst.i32 -1091584273v13 = icmp eq v11, v12 ; v12 = -1091584273@@ -2900,27 +2934,27 @@ block6:block7:v34 = stack_addr.i64 ss0- v35 = load.i32 notrap v34+ v35 = load.i32 notrap aligned v34v15 = call fn4(v35, v12), stack_map=[i32 @ ss0+0, i32 @ ss2+0] ; v12 = -1091584273jump block8(v15)block8(v16: i32):trapz v16, user1v32 = stack_addr.i64 ss0- v33 = load.i32 notrap v32+ v33 = load.i32 notrap aligned v32call fn5(v33), stack_map=[i32 @ ss0+0, i32 @ ss2+0]v17 = call fn6(), stack_map=[i32 @ ss0+0, i32 @ ss2+0]v30 = stack_addr.i64 ss2- v31 = load.i32 notrap v30+ v31 = load.i32 notrap aligned v30brif v17, block5(v31), block9block9:v28 = stack_addr.i64 ss2- v29 = load.i32 notrap v28+ v29 = load.i32 notrap aligned v28call fn7(v29), stack_map=[i32 @ ss2+0]v23 = call fn8(), stack_map=[i32 @ ss2+0]v26 = stack_addr.i64 ss2- v27 = load.i32 notrap v26+ v27 = load.i32 notrap aligned v26brif v23, block10, block1(v27)block10:@@ -3130,7 +3164,7 @@ block0(v0: i32):v1 = call fn0()v2 -> v1v7 = stack_addr.i64 ss0- store notrap v1, v7+ store notrap aligned v1, v7brif v0, block1, block2block1:@@ -3138,10 +3172,10 @@ block1:block2:v5 = stack_addr.i64 ss0- v6 = load.i32 notrap v5+ v6 = load.i32 notrap aligned v5call fn1(v6), stack_map=[i32 @ ss0+0]v3 = stack_addr.i64 ss0- v4 = load.i32 notrap v3+ v4 = load.i32 notrap aligned v3call fn1(v4)return}@@ -3229,15 +3263,15 @@ function %sample() -> i32, i32 system_v {block0:v0 = iconst.i32 11v7 = stack_addr.i64 ss0- store notrap v0, v7 ; v0 = 11+ store notrap aligned v0, v7 ; v0 = 11v1 = iconst.i32 22v6 = stack_addr.i64 ss1- store notrap v1, v6 ; v1 = 22+ store notrap aligned v1, v6 ; v1 = 22call fn0(), stack_map=[i32 @ ss0+0, i32 @ ss1+0]v2 = stack_addr.i64 ss0- v3 = load.i32 notrap v2+ v3 = load.i32 notrap aligned v2v4 = stack_addr.i64 ss1- v5 = load.i32 notrap v4+ v5 = load.i32 notrap aligned v4return v3, v5}"#@@ -3334,31 +3368,112 @@ function %sample() system_v {block0:v0 = call fn0()v13 = stack_addr.i64 ss1- store notrap v0, v13+ store notrap aligned v0, v13jump block1block1:v11 = stack_addr.i64 ss1- v12 = load.i32 notrap v11+ v12 = load.i32 notrap aligned v11call fn1(v12), stack_map=[i32 @ ss1+0]v1 = call fn0(), stack_map=[i32 @ ss1+0]v10 = stack_addr.i64 ss0- store notrap v1, v10+ store notrap aligned v1, v10v8 = stack_addr.i64 ss0- v9 = load.i32 notrap v8+ v9 = load.i32 notrap aligned v8call fn1(v9), stack_map=[i32 @ ss1+0, i32 @ ss0+0]v6 = stack_addr.i64 ss0- v7 = load.i32 notrap v6+ v7 = load.i32 notrap aligned v6brif v7, block2, block1block2:v4 = stack_addr.i64 ss0- v5 = load.i32 notrap v4+ v5 = load.i32 notrap aligned v4call fn1(v5), stack_map=[i32 @ ss0+0]v2 = stack_addr.i64 ss0- v3 = load.i32 notrap v2+ v3 = load.i32 notrap aligned v2call fn1(v3)return+}+ "#+ );+ }++ #[test]+ fn stack_map_alias_region() {+ let _ = env_logger::try_init();++ let sig = Signature::new(CallConv::SystemV);++ let mut fn_ctx = FunctionBuilderContext::new();+ let mut func = Function::with_name_signature(ir::UserFuncName::testcase("sample"), sig);+ let mut builder = FunctionBuilder::new(&mut func, &mut fn_ctx);++ // Place every safepoint spill and reload into a single deduplicated+ // alias region.+ builder.make_stack_map_alias_region(Box::new(|regions, _ty, _slot, _offset| {+ Some(regions.insert(ir::AliasRegionData {+ user_id: 0,+ description: "stack map".into(),+ }))+ }));++ let name = builder+ .func+ .declare_imported_user_function(ir::UserExternalName {+ namespace: 0,+ index: 0,+ });+ let mut sig = Signature::new(CallConv::SystemV);+ sig.params.push(AbiParam::new(ir::types::I32));+ let signature = builder.func.import_signature(sig);+ let func_ref = builder.import_function(ir::ExtFuncData {+ name: ir::ExternalName::user(name),+ signature,+ colocated: true,+ patchable: false,+ });++ // `v0` is live across the first `call` safepoint (it is used again by+ // the second call), so it is spilled at its definition and reloaded at+ // each use. The spill `store` and reload `load`s should all be tagged+ // with the configured alias region.+ //+ // block0:+ // v0 = iconst.i32 42 ; needs stack map+ // call $foo(v0)+ // call $foo(v0)+ // return+ let block0 = builder.create_block();+ builder.append_block_params_for_function_params(block0);+ builder.switch_to_block(block0);+ let v0 = builder.ins().iconst(ir::types::I32, 42);+ builder.declare_value_needs_stack_map(v0);+ builder.ins().call(func_ref, &[v0]);+ builder.ins().call(func_ref, &[v0]);+ builder.ins().return_(&[]);+ builder.seal_all_blocks();+ builder.finalize(systemv_frontend_config());++ assert_eq_output!(+ func.display().to_string(),+ r#"+function %sample() system_v {+ ss0 = explicit_slot 4, align = 4+ region0 = 0 "stack map"+ sig0 = (i32) system_v+ fn0 = colocated u0:0 sig0++block0:+ v0 = iconst.i32 42+ v5 = stack_addr.i64 ss0+ store notrap aligned region0 v0, v5 ; v0 = 42+ v3 = stack_addr.i64 ss0+ v4 = load.i32 notrap aligned region0 v3+ call fn0(v4), stack_map=[i32 @ ss0+0]+ v1 = stack_addr.i64 ss0+ v2 = load.i32 notrap aligned region0 v1+ call fn0(v2)+ return}"#);diff --git a/tests/disas/array-fill-funcref.wat b/tests/disas/array-fill-funcref.watindex 6e286a3bf7..6d938ed87e 100644--- a/tests/disas/array-fill-funcref.wat+++ b/tests/disas/array-fill-funcref.wat@@ -160,10 +160,10 @@;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):;; v56 = stack_addr.i64 ss0-;; store notrap v2, v56+;; store notrap aligned v2, v56;; @0053 v5 = iconst.i32 3;; @0053 v6 = call fn0(v0, v5), stack_map=[i32 @ ss0+0] ; v5 = 3-;; v55 = load.i32 notrap v56+;; v55 = load.i32 notrap aligned v56;; @0057 trapz v55, user16;; @0057 v8 = load.i64 notrap aligned readonly can_move region0 v0+8;; @0057 v9 = load.i64 notrap aligned readonly can_move region2 v8+32diff --git a/tests/disas/gc/array-copy-with-fuel.wat b/tests/disas/gc/array-copy-with-fuel.watindex 245689f03e..03f42737cd 100644--- a/tests/disas/gc/array-copy-with-fuel.wat+++ b/tests/disas/gc/array-copy-with-fuel.wat@@ -27,9 +27,9 @@;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):;; v181 = stack_addr.i64 ss0-;; store notrap v2, v181+;; store notrap aligned v2, v181;; v182 = stack_addr.i64 ss1-;; store notrap v4, v182+;; store notrap aligned v4, v182;; @0020 v7 = load.i64 notrap aligned readonly can_move region0 v0+8;; @0020 v8 = load.i64 notrap aligned region2 v7;; @0020 v9 = iconst.i64 1@@ -46,7 +46,7 @@;; @0020 jump block3(v16);;;; block3(v89: i64):-;; v180 = load.i32 notrap v181+;; v180 = load.i32 notrap aligned v181;; @002b trapz v180, user16;; @002b v24 = load.i64 notrap aligned readonly can_move region3 v7+32;; @002b v22 = uextend.i64 v180@@ -60,7 +60,7 @@;; @002b v29 = uextend.i64 v28;; @002b v35 = icmp ugt v34, v29;; @002b trapnz v35, user17-;; v174 = load.i32 notrap v182+;; v174 = load.i32 notrap aligned v182;; @002b trapz v174, user16;; @002b v46 = uextend.i64 v174;; @002b v49 = iadd v24, v46@@ -93,8 +93,8 @@;; @002b brif.i32 v6, block4, block7(v91);;;; block4:-;; v162 = load.i32 notrap v181-;; v164 = load.i32 notrap v182+;; v162 = load.i32 notrap aligned v181+;; v164 = load.i32 notrap aligned v182;; @002b v92 = icmp.i64 ult v45, v69;; v192 = iadd.i64 v89, v90 ; v90 = 6;; @002b v97 = iadd.i64 v45, v189@@ -105,8 +105,8 @@;; @002b brif v92, block5(v45, v69, v5, v162, v164, v192), block6(v97, v98, v100, v162, v164, v192);;;; block5(v101: i64, v102: i64, v103: i32, v104: i32, v105: i32, v106: i64):-;; store notrap v104, v181-;; store notrap v105, v182+;; store notrap aligned v104, v181+;; store notrap aligned v105, v182;; v202 = iconst.i64 1;; v203 = iadd v106, v202 ; v202 = 1;; v204 = iconst.i64 0@@ -114,8 +114,8 @@;; @002b brif v205, block8, block9(v203);;;; block6(v123: i64, v124: i64, v125: i32, v126: i32, v127: i32, v128: i64):-;; store notrap v126, v182-;; store notrap v127, v181+;; store notrap aligned v126, v182+;; store notrap aligned v127, v181;; v193 = iconst.i64 1;; v194 = iadd v128, v193 ; v193 = 1;; v195 = iconst.i64 0@@ -134,8 +134,8 @@;; block9(v145: i64):;; @002b v115 = load.i32 user2 little region5 v102;; @002b store user2 little region5 v115, v101-;; v150 = load.i32 notrap v181-;; v152 = load.i32 notrap v182+;; v150 = load.i32 notrap aligned v181+;; v152 = load.i32 notrap aligned v182;; v206 = iconst.i64 4;; v207 = iadd.i64 v102, v206 ; v206 = 4;; @002b v122 = icmp eq v207, v98@@ -156,8 +156,8 @@;; @002b v143 = load.i32 user2 little region5 v198;; v199 = isub.i64 v123, v197 ; v197 = 4;; @002b store user2 little region5 v143, v199-;; v156 = load.i32 notrap v182-;; v158 = load.i32 notrap v181+;; v156 = load.i32 notrap aligned v182+;; v158 = load.i32 notrap aligned v181;; @002b v144 = icmp eq v198, v69;; v200 = iconst.i32 1;; v201 = isub.i32 v125, v200 ; v200 = 1diff --git a/tests/disas/gc/array-new-data.wat b/tests/disas/gc/array-new-data.watindex 0a0088eacf..82e9d913b0 100644--- a/tests/disas/gc/array-new-data.wat+++ b/tests/disas/gc/array-new-data.wat@@ -158,7 +158,7 @@;;;; block4(v52: i32, v53: i64):;; v112 = stack_addr.i64 ss0-;; store notrap v52, v112+;; store notrap aligned v52, v112;; @0025 v54 = iconst.i64 16;; @0025 v55 = iadd v53, v54 ; v54 = 16;; @0025 store.i32 user2 region9 v3, v55@@ -189,6 +189,6 @@;; @0029 jump block1;;;; block1:-;; v105 = load.i32 notrap v112+;; v105 = load.i32 notrap aligned v112;; @0029 return v105;; }diff --git a/tests/disas/gc/array-new-default-f32.wat b/tests/disas/gc/array-new-default-f32.watindex e8f44f62f7..678c6c2367 100644--- a/tests/disas/gc/array-new-default-f32.wat+++ b/tests/disas/gc/array-new-default-f32.wat@@ -87,7 +87,7 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap v40, v89+;; store notrap aligned v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region7 v2, v43@@ -113,6 +113,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap v89+;; v82 = load.i32 notrap aligned v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-f64.wat b/tests/disas/gc/array-new-default-f64.watindex d0f0c595b0..483bbbb120 100644--- a/tests/disas/gc/array-new-default-f64.wat+++ b/tests/disas/gc/array-new-default-f64.wat@@ -87,7 +87,7 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap v40, v89+;; store notrap aligned v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region7 v2, v43@@ -113,6 +113,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap v89+;; v82 = load.i32 notrap aligned v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-funcref.wat b/tests/disas/gc/array-new-default-funcref.watindex f395a8877a..a35bad4f5a 100644--- a/tests/disas/gc/array-new-default-funcref.wat+++ b/tests/disas/gc/array-new-default-funcref.wat@@ -87,7 +87,7 @@;;;; block4(v40: i32, v41: i64):;; v97 = stack_addr.i64 ss0-;; store notrap v40, v97+;; store notrap aligned v40, v97;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region7 v2, v43@@ -127,6 +127,6 @@;; @0022 jump block1;;;; block1:-;; v90 = load.i32 notrap v97+;; v90 = load.i32 notrap aligned v97;; @0022 return v90;; }diff --git a/tests/disas/gc/array-new-default-i16.wat b/tests/disas/gc/array-new-default-i16.watindex c74f3359f3..d45bf7cd74 100644--- a/tests/disas/gc/array-new-default-i16.wat+++ b/tests/disas/gc/array-new-default-i16.wat@@ -86,7 +86,7 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap v40, v89+;; store notrap aligned v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region7 v2, v43@@ -112,6 +112,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap v89+;; v82 = load.i32 notrap aligned v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-i32.wat b/tests/disas/gc/array-new-default-i32.watindex c9516ce94b..2a06e98482 100644--- a/tests/disas/gc/array-new-default-i32.wat+++ b/tests/disas/gc/array-new-default-i32.wat@@ -87,7 +87,7 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap v40, v89+;; store notrap aligned v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region7 v2, v43@@ -113,6 +113,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap v89+;; v82 = load.i32 notrap aligned v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-i64.wat b/tests/disas/gc/array-new-default-i64.watindex fdf1bf747b..af47551731 100644--- a/tests/disas/gc/array-new-default-i64.wat+++ b/tests/disas/gc/array-new-default-i64.wat@@ -87,7 +87,7 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap v40, v89+;; store notrap aligned v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region7 v2, v43@@ -113,6 +113,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap v89+;; v82 = load.i32 notrap aligned v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-i8.wat b/tests/disas/gc/array-new-default-i8.watindex bf17d2af28..4abe955d3a 100644--- a/tests/disas/gc/array-new-default-i8.wat+++ b/tests/disas/gc/array-new-default-i8.wat@@ -83,7 +83,7 @@;;;; block4(v40: i32, v41: i64):;; v88 = stack_addr.i64 ss0-;; store notrap v40, v88+;; store notrap aligned v40, v88;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16;; @001f store.i32 user2 region7 v2, v43@@ -109,6 +109,6 @@;; @0022 jump block1;;;; block1:-;; v81 = load.i32 notrap v88+;; v81 = load.i32 notrap aligned v88;; @0022 return v81;; }diff --git a/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/copying/array-new-fixed-of-gc-refs.watindex 7e7f522af8..a69f46da0f 100644--- a/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat+++ b/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat@@ -30,11 +30,11 @@;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):;; v137 = stack_addr.i64 ss2-;; store notrap v2, v137+;; store notrap aligned v2, v137;; v138 = stack_addr.i64 ss1-;; store notrap v3, v138+;; store notrap aligned v3, v138;; v139 = stack_addr.i64 ss0-;; store notrap v4, v139+;; store notrap aligned v4, v139;; @0025 v14 = load.i64 notrap aligned readonly can_move region2 v0+32;; @0025 v15 = load.i32 notrap aligned region3 v14;; @0025 v16 = load.i32 notrap aligned region4 v14+4@@ -98,7 +98,7 @@;; @0025 v6 = iconst.i32 20;; @0025 v63 = uadd_overflow_trap v181, v6, user2 ; v6 = 20;; @0025 v67 = uadd_overflow_trap v43, v63, user2-;; v136 = load.i32 notrap v137+;; v136 = load.i32 notrap aligned v137;; @0025 v68 = uextend.i64 v67;; @0025 v71 = iadd v267, v68;; @0025 v72 = isub v63, v6 ; v6 = 20@@ -116,7 +116,7 @@;; v207 = ishl v82, v180 ; v180 = 2;; @0025 v91 = uadd_overflow_trap v207, v6, user2 ; v6 = 20;; @0025 v95 = uadd_overflow_trap v43, v91, user2-;; v134 = load.i32 notrap v138+;; v134 = load.i32 notrap aligned v138;; @0025 v96 = uextend.i64 v95;; @0025 v99 = iadd v267, v96;; v220 = iconst.i32 24@@ -134,7 +134,7 @@;; v235 = ishl v110, v180 ; v180 = 2;; @0025 v119 = uadd_overflow_trap v235, v6, user2 ; v6 = 20;; @0025 v123 = uadd_overflow_trap v43, v119, user2-;; v132 = load.i32 notrap v139+;; v132 = load.i32 notrap aligned v139;; @0025 v124 = uextend.i64 v123;; @0025 v127 = iadd v267, v124;; v253 = iconst.i32 28diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat b/tests/disas/gc/copying/funcref-in-gc-heap-new.watindex 2058afd32e..8324131911 100644--- a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat+++ b/tests/disas/gc/copying/funcref-in-gc-heap-new.wat@@ -69,7 +69,7 @@;;;; block4(v33: i32, v34: i64):;; v41 = stack_addr.i64 ss0-;; store notrap v33, v41+;; store notrap aligned v33, v41;; @0020 v37 = call fn1(v0, v2), stack_map=[i32 @ ss0+0];; @0020 v38 = ireduce.i32 v37;; @0020 v35 = iconst.i64 16@@ -78,6 +78,6 @@;; @0023 jump block1;;;; block1:-;; v40 = load.i32 notrap v41+;; v40 = load.i32 notrap aligned v41;; @0023 return v40;; }diff --git a/tests/disas/gc/copying/struct-new.wat b/tests/disas/gc/copying/struct-new.watindex 119e1c4717..d6ecce6975 100644--- a/tests/disas/gc/copying/struct-new.wat+++ b/tests/disas/gc/copying/struct-new.wat@@ -29,7 +29,7 @@;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):;; v45 = stack_addr.i64 ss0-;; store notrap v4, v45+;; store notrap aligned v4, v45;; @002a v6 = load.i64 notrap aligned readonly can_move region2 v0+32;; @002a v7 = load.i32 notrap aligned region3 v6;; @002a v8 = load.i32 notrap aligned region4 v6+4@@ -76,7 +76,7 @@;; @002a v39 = iconst.i64 20;; @002a v40 = iadd v36, v39 ; v39 = 20;; @002a istore8.i32 user2 little region7 v3, v40-;; v44 = load.i32 notrap v45+;; v44 = load.i32 notrap aligned v45;; @002a v41 = iconst.i64 24;; @002a v42 = iadd v36, v41 ; v41 = 24;; @002a store user2 little region7 v44, v42diff --git a/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/drc/array-new-fixed-of-gc-refs.watindex 8bf807747c..351723d817 100644--- a/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat+++ b/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat@@ -28,11 +28,11 @@;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):;; v202 = stack_addr.i64 ss2-;; store notrap v2, v202+;; store notrap aligned v2, v202;; v203 = stack_addr.i64 ss1-;; store notrap v3, v203+;; store notrap aligned v3, v203;; v204 = stack_addr.i64 ss0-;; store notrap v4, v204+;; store notrap aligned v4, v204;; @0025 v14 = iconst.i32 -1476395008;; @0025 v15 = load.i64 notrap aligned readonly can_move region2 v0+40;; @0025 v16 = load.i32 notrap aligned readonly can_move v15@@ -49,7 +49,7 @@;; @0025 store user2 region4 v5, v24 ; v5 = 3;; @0025 trapz v18, user16;; @0025 v45 = uadd_overflow_trap v18, v216, user2 ; v216 = 40-;; v201 = load.i32 notrap v202+;; v201 = load.i32 notrap aligned v202;; @0025 v53 = iconst.i32 1;; @0025 v54 = band v201, v53 ; v53 = 1;; @0025 v25 = iconst.i32 0@@ -59,7 +59,7 @@;; @0025 brif v58, block3, block2;;;; block2:-;; v197 = load.i32 notrap v202+;; v197 = load.i32 notrap aligned v202;; @0025 v59 = uextend.i64 v197;; @0025 v62 = iadd.i64 v20, v59;; @0025 v63 = iconst.i64 8@@ -71,7 +71,7 @@;; @0025 jump block3;;;; block3:-;; v193 = load.i32 notrap v202+;; v193 = load.i32 notrap aligned v202;; @0025 v46 = uextend.i64 v45;; @0025 v49 = iadd.i64 v20, v46;; v206 = iconst.i64 12@@ -93,7 +93,7 @@;; @0025 v6 = iconst.i32 28;; @0025 v90 = uadd_overflow_trap v258, v6, user2 ; v6 = 28;; @0025 v94 = uadd_overflow_trap.i32 v18, v90, user2-;; v191 = load.i32 notrap v203+;; v191 = load.i32 notrap aligned v203;; v312 = band v191, v310 ; v310 = 1;; v313 = iconst.i32 0;; v314 = icmp eq v191, v313 ; v313 = 0@@ -102,7 +102,7 @@;; @0025 brif v107, block5, block4;;;; block4:-;; v187 = load.i32 notrap v203+;; v187 = load.i32 notrap aligned v203;; @0025 v108 = uextend.i64 v187;; @0025 v111 = iadd.i64 v20, v108;; v315 = iconst.i64 8@@ -114,7 +114,7 @@;; @0025 jump block5;;;; block5:-;; v183 = load.i32 notrap v203+;; v183 = load.i32 notrap aligned v203;; @0025 v95 = uextend.i64 v94;; @0025 v98 = iadd.i64 v20, v95;; v271 = iconst.i32 32@@ -137,7 +137,7 @@;; v325 = iconst.i32 28;; @0025 v139 = uadd_overflow_trap v324, v325, user2 ; v325 = 28;; @0025 v143 = uadd_overflow_trap.i32 v18, v139, user2-;; v181 = load.i32 notrap v204+;; v181 = load.i32 notrap aligned v204;; v326 = iconst.i32 1;; v327 = band v181, v326 ; v326 = 1;; v328 = iconst.i32 0@@ -147,7 +147,7 @@;; @0025 brif v156, block7, block6;;;; block6:-;; v177 = load.i32 notrap v204+;; v177 = load.i32 notrap aligned v204;; @0025 v157 = uextend.i64 v177;; @0025 v160 = iadd.i64 v20, v157;; v330 = iconst.i64 8@@ -159,7 +159,7 @@;; @0025 jump block7;;;; block7:-;; v173 = load.i32 notrap v204+;; v173 = load.i32 notrap aligned v204;; @0025 v144 = uextend.i64 v143;; @0025 v147 = iadd.i64 v20, v144;; v303 = iconst.i32 36diff --git a/tests/disas/gc/drc/externref-globals.wat b/tests/disas/gc/drc/externref-globals.watindex 3617ade5e7..c0e9e4565b 100644--- a/tests/disas/gc/drc/externref-globals.wat+++ b/tests/disas/gc/drc/externref-globals.wat@@ -36,7 +36,7 @@;; @0034 v3 = iadd v0, v2 ; v2 = 48;; @0034 v4 = load.i32 notrap aligned region2 v3;; v76 = stack_addr.i64 ss0-;; store notrap v4, v76+;; store notrap aligned v4, v76;; @0034 v5 = iconst.i32 1;; @0034 v6 = band v4, v5 ; v5 = 1;; @0034 v7 = iconst.i32 0@@ -93,7 +93,7 @@;; @0036 jump block1;;;; block1:-;; v59 = load.i32 notrap v76+;; v59 = load.i32 notrap aligned v76;; @0036 return v59;; };;diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-new.wat b/tests/disas/gc/drc/funcref-in-gc-heap-new.watindex a7ec734b38..c2f37b0cf3 100644--- a/tests/disas/gc/drc/funcref-in-gc-heap-new.wat+++ b/tests/disas/gc/drc/funcref-in-gc-heap-new.wat@@ -33,7 +33,7 @@;; @0020 v7 = iconst.i32 8;; @0020 v8 = call fn0(v0, v4, v6, v3, v7) ; v4 = -1342177280, v3 = 32, v7 = 8;; v21 = stack_addr.i64 ss0-;; store notrap v8, v21+;; store notrap aligned v8, v21;; @0020 v15 = call fn1(v0, v2), stack_map=[i32 @ ss0+0];; @0020 v16 = ireduce.i32 v15;; @0020 v9 = load.i64 notrap aligned readonly can_move region0 v0+8@@ -46,6 +46,6 @@;; @0023 jump block1;;;; block1:-;; v18 = load.i32 notrap v21+;; v18 = load.i32 notrap aligned v21;; @0023 return v18;; }diff --git a/tests/disas/gc/drc/struct-get.wat b/tests/disas/gc/drc/struct-get.watindex a3d4b53082..4505d20f0a 100644--- a/tests/disas/gc/drc/struct-get.wat+++ b/tests/disas/gc/drc/struct-get.wat@@ -131,7 +131,7 @@;; @004e v8 = iadd v6, v7 ; v7 = 32;; @004e v9 = load.i32 user2 little region4 v8;; v81 = stack_addr.i64 ss0-;; store notrap v9, v81+;; store notrap aligned v9, v81;; @004e v10 = iconst.i32 1;; @004e v11 = band v9, v10 ; v10 = 1;; @004e v12 = iconst.i32 0@@ -186,6 +186,6 @@;; @0052 jump block1;;;; block1:-;; v64 = load.i32 notrap v81+;; v64 = load.i32 notrap aligned v81;; @0052 return v64;; }diff --git a/tests/disas/gc/drc/struct-new.wat b/tests/disas/gc/drc/struct-new.watindex b3811d718f..5532fe6512 100644--- a/tests/disas/gc/drc/struct-new.wat+++ b/tests/disas/gc/drc/struct-new.wat@@ -28,7 +28,7 @@;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):;; v52 = stack_addr.i64 ss0-;; store notrap v4, v52+;; store notrap aligned v4, v52;; @002a v6 = iconst.i32 -1342177280;; @002a v7 = load.i64 notrap aligned readonly can_move region2 v0+40;; @002a v8 = load.i32 notrap aligned readonly can_move v7@@ -45,7 +45,7 @@;; @002a v17 = iconst.i64 28;; @002a v18 = iadd v14, v17 ; v17 = 28;; @002a istore8 user2 little region4 v3, v18-;; v51 = load.i32 notrap v52+;; v51 = load.i32 notrap aligned v52;; @002a v21 = iconst.i32 1;; @002a v22 = band v51, v21 ; v21 = 1;; @002a v23 = iconst.i32 0diff --git a/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/null/array-new-fixed-of-gc-refs.watindex fcb844fc17..32b006b866 100644--- a/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat+++ b/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat@@ -30,11 +30,11 @@;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):;; v131 = stack_addr.i64 ss2-;; store notrap v2, v131+;; store notrap aligned v2, v131;; v132 = stack_addr.i64 ss1-;; store notrap v3, v132+;; store notrap aligned v3, v132;; v133 = stack_addr.i64 ss0-;; store notrap v4, v133+;; store notrap aligned v4, v133;; @0025 v17 = load.i64 notrap aligned readonly can_move region2 v0+32;; @0025 v18 = load.i32 notrap aligned region3 v17;; v151 = iconst.i32 7@@ -67,7 +67,7 @@;; @0025 trapz v256, user16;; v258 = iconst.i32 24;; @0025 v61 = uadd_overflow_trap v256, v258, user2 ; v258 = 24-;; v130 = load.i32 notrap v131+;; v130 = load.i32 notrap aligned v131;; @0025 v62 = uextend.i64 v61;; @0025 v65 = iadd v32, v62;; v135 = iconst.i64 12@@ -88,7 +88,7 @@;; @0025 v6 = iconst.i32 12;; @0025 v85 = uadd_overflow_trap v205, v6, user2 ; v6 = 12;; @0025 v89 = uadd_overflow_trap v256, v85, user2-;; v128 = load.i32 notrap v132+;; v128 = load.i32 notrap aligned v132;; @0025 v90 = uextend.i64 v89;; @0025 v93 = iadd v32, v90;; v218 = iconst.i32 16@@ -106,7 +106,7 @@;; v233 = ishl v104, v175 ; v175 = 2;; @0025 v113 = uadd_overflow_trap v233, v6, user2 ; v6 = 12;; @0025 v117 = uadd_overflow_trap v256, v113, user2-;; v126 = load.i32 notrap v133+;; v126 = load.i32 notrap aligned v133;; @0025 v118 = uextend.i64 v117;; @0025 v121 = iadd v32, v118;; v250 = iconst.i32 20diff --git a/tests/disas/gc/null/struct-new.wat b/tests/disas/gc/null/struct-new.watindex 2d6efd4a4a..655f22640c 100644--- a/tests/disas/gc/null/struct-new.wat+++ b/tests/disas/gc/null/struct-new.wat@@ -30,7 +30,7 @@;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):;; v39 = stack_addr.i64 ss0-;; store notrap v4, v39+;; store notrap aligned v4, v39;; @002a v9 = load.i64 notrap aligned readonly can_move region2 v0+32;; @002a v10 = load.i32 notrap aligned region3 v9;; v46 = iconst.i32 7@@ -62,7 +62,7 @@;; @002a v33 = iconst.i64 12;; @002a v34 = iadd v26, v33 ; v33 = 12;; @002a istore8.i32 user2 little region7 v3, v34-;; v38 = load.i32 notrap v39+;; v38 = load.i32 notrap aligned v39;; @002a v35 = iconst.i64 16;; @002a v36 = iadd v26, v35 ; v35 = 16;; @002a store user2 little region7 v38, v36diff --git a/tests/disas/gc/struct-new.wat b/tests/disas/gc/struct-new.watindex fc9f5a48a7..c5410f816f 100644--- a/tests/disas/gc/struct-new.wat+++ b/tests/disas/gc/struct-new.wat@@ -30,7 +30,7 @@;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):;; v45 = stack_addr.i64 ss0-;; store notrap v4, v45+;; store notrap aligned v4, v45;; @002a v6 = load.i64 notrap aligned readonly can_move region2 v0+32;; @002a v7 = load.i32 notrap aligned region3 v6;; @002a v8 = load.i32 notrap aligned region4 v6+4@@ -77,7 +77,7 @@;; @002a v39 = iconst.i64 20;; @002a v40 = iadd v36, v39 ; v39 = 20;; @002a istore8.i32 user2 little region7 v3, v40-;; v44 = load.i32 notrap v45+;; v44 = load.i32 notrap aligned v45;; @002a v41 = iconst.i64 24;; @002a v42 = iadd v36, v41 ; v41 = 24;; @002a store user2 little region7 v44, v42diff --git a/tests/disas/gc/typed-select-and-stack-maps.wat b/tests/disas/gc/typed-select-and-stack-maps.watindex 3ec5ae3d6a..9ed4f232c9 100644--- a/tests/disas/gc/typed-select-and-stack-maps.wat+++ b/tests/disas/gc/typed-select-and-stack-maps.wat@@ -55,11 +55,11 @@;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):;; @0049 v5 = select v4, v2, v3;; v12 = stack_addr.i64 ss0-;; store notrap v5, v12+;; store notrap aligned v5, v12;; @004c v7 = load.i64 notrap aligned readonly can_move region3 v0+88;; @004c v6 = load.i64 notrap aligned readonly can_move region2 v0+104;; @004c call_indirect sig0, v7(v6, v0), stack_map=[i32 @ ss0+0]-;; v11 = load.i32 notrap v12+;; v11 = load.i32 notrap aligned v12;; @004e v9 = load.i64 notrap aligned readonly can_move region3 v0+56;; @004e v8 = load.i64 notrap aligned readonly can_move region2 v0+72;; @004e call_indirect sig1, v9(v8, v0, v11)