[WebAssembly] Remove unreachable EH pads
authorHeejin Ahn <aheejin@gmail.com>
Sun, 27 Dec 2020 10:52:43 +0000 (02:52 -0800)
committerHeejin Ahn <aheejin@gmail.com>
Sat, 9 Jan 2021 11:42:38 +0000 (03:42 -0800)
commit4e4df1e38d6b66083b3badb78e56b8b0f6045fd1
treeac44616a117cccb6bd07c713ef492adae55c6ecf
parent2c442629f0bd210fdb76fa409e131c87387e884d
[WebAssembly] Remove unreachable EH pads

This removes unreachable EH pads in LateEHPrepare. This is not for
optimization but for preparation for CFGStackify. In CFGStackify, we
determine where to place `try` marker by computing the nearest common
dominator of all predecessors of an EH pad, but when an EH pad does not
have a predecessor, it becomes tricky. We can insert an empty dummy BB
before the EH pad and place the `try` there, but removing unreachable EH
pads is simpler.

This moves an existing exception label test from eh-label.mir to
exception.mir and adds a new test there.

This also adds some comments to existing methods.

Reviewed By: dschuff, tlively

Differential Revision: https://reviews.llvm.org/D94044
llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
llvm/test/CodeGen/WebAssembly/exception.mir [moved from llvm/test/CodeGen/WebAssembly/eh-labels.mir with 64% similarity]