[WebAssembly] Split BBs after throw instructions
authorHeejin Ahn <aheejin@gmail.com>
Fri, 16 Nov 2018 00:47:18 +0000 (00:47 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Fri, 16 Nov 2018 00:47:18 +0000 (00:47 +0000)
commit095796a391e5e8343ce462ce97fdc493d20478cd
tree53daa4333ce0a05d5da5f3b9b8998d4ed88ef4c9
parent2f5683e6b0d3c7348929e05a2a781690e598c533
[WebAssembly] Split BBs after throw instructions

Summary:
`throw` instruction is a terminator in wasm, but BBs were not splitted
after `throw` instructions, causing machine instruction verifier to
fail.

This patch
- Splits BBs after `throw` instructions in WasmEHPrepare and adding an
  unreachable instruction after `throw`, which will be deleted in
  LateEHPrepare pass
- Refactors WasmEHPrepare into two member functions
- Changes the semantics of `eraseBBsAndChildren` in LateEHPrepare pass
  to match that of WasmEHPrepare pass, which is newly added. Now
  `eraseBBsAndChildren` does not delete BBs with remaining predecessors.
- Fixes style nits, making static function names conform to clang-tidy
- Re-enables the test temporarily disabled by rL346840 && rL346845

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D54571

llvm-svn: 347003
llvm/lib/CodeGen/WasmEHPrepare.cpp
llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
llvm/test/CodeGen/WebAssembly/exception.ll
llvm/test/CodeGen/WebAssembly/wasmehprepare.ll
llvm/test/MC/WebAssembly/event-section.ll