summaryrefslogtreecommitdiff
path: root/src/ir/block-utils.h
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-12-30 17:55:20 -0800
committerGitHub <noreply@github.com>2019-12-30 17:55:20 -0800
commitbcc76146fed433cbc8ba01a9f568d979c145110b (patch)
treeab70ad24afc257b73513c3e62f3aab9938d05944 /src/ir/block-utils.h
parenta30f1df5696ccb3490e2eaa3a9ed5e7e487c7b0e (diff)
downloadbinaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.tar.gz
binaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.tar.bz2
binaryen-bcc76146fed433cbc8ba01a9f568d979c145110b.zip
Add support for reference types proposal (#2451)
This adds support for the reference type proposal. This includes support for all reference types (`anyref`, `funcref`(=`anyfunc`), and `nullref`) and four new instructions: `ref.null`, `ref.is_null`, `ref.func`, and new typed `select`. This also adds subtype relationship support between reference types. This does not include table instructions yet. This also does not include wasm2js support. Fixes #2444 and fixes #2447.
Diffstat (limited to 'src/ir/block-utils.h')
-rw-r--r--src/ir/block-utils.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ir/block-utils.h b/src/ir/block-utils.h
index ca8b7179b..153dd45b3 100644
--- a/src/ir/block-utils.h
+++ b/src/ir/block-utils.h
@@ -43,7 +43,8 @@ simplifyToContents(Block* block, T* parent, bool allowTypeChange = false) {
// no side effects, and singleton is not returning a value, so we can
// throw away the block and its contents, basically
return Builder(*parent->getModule()).replaceWithIdenticalType(block);
- } else if (block->type == singleton->type || allowTypeChange) {
+ } else if (Type::isSubType(singleton->type, block->type) ||
+ allowTypeChange) {
return singleton;
} else {
// (side effects +) type change, must be block with declared value but