This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] support "return" and unreachable code in asm type checker
ClosedPublic

Authored by aardappel on Nov 1 2021, 1:11 PM.

Details

Summary

To support return (it not being supported well was the ground cause for
https://github.com/WebAssembly/wasi-sdk/issues/200) we also have to have
at least a basic notion of unreachable, which in this case just means to stop
type checking until there is an end_block (an incoming control flow edge).
This is conservative (may miss on some type checking opportunities) but is
simple and an improvement over what we had before.

Diff Detail

Event Timeline

aardappel created this revision.Nov 1 2021, 1:11 PM
aardappel requested review of this revision.Nov 1 2021, 1:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2021, 1:11 PM
sbc100 accepted this revision.Nov 1 2021, 1:39 PM

lgtm % clang-format stuff.

lld/test/wasm/lto/thinlto-thin-archive-collision.ll
3 ↗(On Diff #383866)

Seems unrelated?

This revision is now accepted and ready to land.Nov 1 2021, 1:39 PM
aardappel added inline comments.Nov 1 2021, 1:42 PM
lld/test/wasm/lto/thinlto-thin-archive-collision.ll
3 ↗(On Diff #383866)

It was needed to make tests pass on my machine, and since it is a tiny change it seemed ok

sbc100 added inline comments.Nov 1 2021, 1:48 PM
lld/test/wasm/lto/thinlto-thin-archive-collision.ll
3 ↗(On Diff #383866)

Hmm. That is strange. Since it completely unrelated I don't think you should land this as part of this change.

dschuff accepted this revision.Nov 1 2021, 3:33 PM

Are there any type checker tests that are expected to fail?

llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
77
aardappel updated this revision to Diff 383913.Nov 1 2021, 3:40 PM
aardappel marked an inline comment as done.

Removed unrelated fix and formatting

This revision was landed with ongoing or failed builds.Nov 1 2021, 3:43 PM
This revision was automatically updated to reflect the committed changes.