This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix a bug in 'try' placement
ClosedPublic

Authored by aheejin on Oct 7 2019, 6:07 PM.

Details

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.

Event Timeline

aheejin created this revision.Oct 7 2019, 6:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2019, 6:07 PM
aheejin edited the summary of this revision. (Show Details)Oct 7 2019, 6:09 PM
dschuff accepted this revision.Oct 8 2019, 7:55 AM
This revision is now accepted and ready to land.Oct 8 2019, 7:55 AM
This revision was automatically updated to reflect the committed changes.