When I committed r310809, I didn't realize that it exposed a bug in the compare lowering I committed previously. Namely the issue is that compares of i32 values used code that produces 64-bit immediate results. When the register allocator spilled one of those intermediate values, it would spill/reload it as a 32-bit value. The sign bits are then lost and the comparison produces incorrect results.
This patch is basically r310809 but with the addition of the fix for the spilling issue. Namely, we now ensure that if the intermediate results are 64-bit values, the value is changed to an i64 so that it is spilled/reloaded as a 64-bit entity.