From 5ef69f638d4b3aa6ee49c5456a93c00acc4d493e Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Fri, 5 Jun 2026 17:57:04 -0700 Subject: [PATCH] [Wasm RyuJit] Match how other targets consume initblk fill values genConsumeOperands(blkOp) routed the contained GT_INIT_VAL through genConsumeRegs and tripped its OperIsLeaf assert. Replace the call with explicit consume of dest and the unwrapped src, as other targets do. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/coreclr/jit/codegenwasm.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/coreclr/jit/codegenwasm.cpp b/src/coreclr/jit/codegenwasm.cpp index e8f750d8f9e9dd..5e0ef32ec930f0 100644 --- a/src/coreclr/jit/codegenwasm.cpp +++ b/src/coreclr/jit/codegenwasm.cpp @@ -3093,7 +3093,12 @@ void CodeGen::genCodeForStoreBlk(GenTreeBlk* blkOp) unsigned destOffset = 0; unsigned srcOffset = 0; - genConsumeOperands(blkOp); + // Unwrap a contained GT_INIT_VAL so the wrapped fill value (not the wrapper) is pushed onto the WASM value stack. + GenTree* srcForConsume = src->OperIs(GT_INIT_VAL) ? src->gtGetOp1() : src; + assert(!src->OperIs(GT_INIT_VAL) || src->isContained()); + + genConsumeRegs(dest); + genConsumeRegs(srcForConsume); // If the source is a byref or pointer it will be a GT_IND that we need to unwrap to extract the // actual address we're loading from. Note that this does not apply to the destination.