HomePhabricator

[WebAssembly] Fix a bug in 'try' placement

Description

[WebAssembly] Fix a bug in 'try' placement

Summary:
When searching for local expression tree created by stackified
registers, for 'block' placement, we start the search from the previous
instruction of a BB's terminator. But in 'try''s case, we should start
from the previous instruction of a call that can throw, or a EH_LABEL
that precedes the call, because the return values of the call's previous
instructions can be stackified and consumed by the throwing call.

For example,

i32.call @foo
call @bar         ; may throw
br $label0

In this case, if we start the search from the previous instruction of
the terminator (br here), we end up stopping at call @bar and place
a 'try' between i32.call @foo and call @bar, because call @bar
does not have a return value so it is not a local expression tree of
br.

But in this case, unlike when placing 'block's, we should start the
search from call @bar, because the return value of i32.call @foo is
stackified and used by call @bar.

Reviewers: dschuff

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

Tags: #llvm

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

Details

Committed
aheejinOct 8 2019, 9:15 AM
Differential Revision
D68619: [WebAssembly] Fix a bug in 'try' placement
Parents
rL374072: [OPENMP50]Prohibit multiple context selector sets in context selectors.
Branches
Unknown
Tags
Unknown