[WebAssembly] Fix unwind destination mismatches in CFG stackify
authorHeejin Ahn <aheejin@gmail.com>
Sat, 30 Mar 2019 11:04:48 +0000 (11:04 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Sat, 30 Mar 2019 11:04:48 +0000 (11:04 +0000)
commitc4ac74fb4987c083fa8e7e10f0f978ecee9402c0
treea92104e16ccb89b0690f7684845824756ea1f3aa
parente9fd9073e4905eab7c0784cee804f0704a7020de
[WebAssembly] Fix unwind destination mismatches in CFG stackify

Summary:
Linearing the control flow by placing `try`/`end_try` markers can create
mismatches in unwind destinations. This patch resolves these mismatches
by wrapping those instructions with an incorrect unwind destination with
a nested `try`/`catch`/`end_try` and branching to the right destination
within the new catch block.

Reviewers: dschuff

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

Tags: #llvm

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

llvm-svn: 357343
llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp
llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll