After the staack is unwound due to a thrown exxception,
__stack_pointer global can point to an invalid address. So
a global.set to restore __stack_pointer should be inserted right
after catch instruction.
But after D57134 the global.set instruction is inserted not right
after catch but after block - br-on-exn - end_block -
extract_exception sequence. This CL fixes it.
While doing that, we can actually move ReplacePhysRegs pass after
LateEHPrepare and merge EHRestoreStackPointer pass into LateEHPrepare,
and now placing global.set to __stack_pointer right after catch is
much easier. Otherwise it is hard to guarantee that global.set is
still right after catch and not touched with other transformations, in
which case we have to do something to hoist it.
Is this comment still accurate? We don't need so many catch_all instructions now, right?