Open
Description
Currently, each codegen backend and the MIR interpreter needs to re-implement this logic:
Turns out the interpreter version actually has a bug. Ideally we'd only have this logic once so that we don't need the same subtle logic in multiple places.