Similar to all the control instructions, any state must be explicitly saved before emitting the code for br_if.
This commit ensures that live locals and registers are explicilty saved before emitting the code for br_if. Prior to this commit, live locals and registers were not saved every time causing incorrect behavior in cases where the calculation of the conditional argument didn't trigger a spill.
This change introduces the explicit spill after calculating the branch condition argument to minimize memory traffic in case the conditional is already in a register.
Fixes: https://github.com/bytecodealliance/wasmtime/issues/8848
Similar to all the control instructions, any state must be explicitly saved before emitting the code for
br_if
.This commit ensures that live locals and registers are explicilty saved before emitting the code for
br_if
. Prior to this commit, live locals and registers were not saved every time causing incorrect behavior in cases where the calculation of the conditional argument didn't trigger a spill.This change introduces the explicit spill after calculating the branch condition argument to minimize memory traffic in case the conditional is already in a register.