When adding a 'br_on_exn' instruction, we transform code as follows:
- Before:
ehpad:
%exnref:except_ref = catch %exn:i32 = extract_exception ... call @foo() // can throw
- After:
ehpad:
%exnref:except_ref = catch br_on_exn %thenbb, $__cpp_exception, %exnref br %elsebb
elsebb:
rethrow
thenbb:
%exn:i32 = extract_exception ... call @foo() // can throw
So if an ehpad ends with an instruction that can throw, there is a
ThrowUnwindDest mapping of <ehpad, otherbb>, which means if an
instruction in 'ehpad' throws it should go to 'otherbb'. In that case,
we should've updated it to <thenbb, otherbb>. This fixes the bug, and
also adds member functions to erase mappings in WasmEHFuncInfo.
It's hard to add a test for this because target-specific
MachineFunctionInfo is not serialized at the moment.