Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/ir-util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ ModuleContext::Arities ModuleContext::GetExprArity(const Expr& expr) const {
case ExprType::MemoryFill:
case ExprType::MemoryCopy:
case ExprType::TableCopy:
case ExprType::TableFill:
return { 3, 0 };

case ExprType::AtomicLoad:
Expand All @@ -181,6 +182,7 @@ ModuleContext::Arities ModuleContext::GetExprArity(const Expr& expr) const {
case ExprType::Unary:
case ExprType::TableGet:
case ExprType::RefIsNull:
case ExprType::LoadSplat:
return { 1, 1 };

case ExprType::Drop:
Expand Down Expand Up @@ -257,10 +259,5 @@ ModuleContext::Arities ModuleContext::GetExprArity(const Expr& expr) const {

case ExprType::SimdShuffleOp:
return { 2, 1 };

default:
fprintf(stderr, "bad expr type: %s\n", GetExprTypeName(expr));
assert(0);
return { 0, 0 };
}
}
41 changes: 34 additions & 7 deletions test/roundtrip/fold-reference-types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,47 @@

(module
(table $t 1 externref)
(elem declare func 0)
(func
i32.const 0
i32.const 0
table.get $t
table.set $t
(local externref)

i32.const 0 table.get $t drop
i32.const 0 local.get 0 table.set $t
local.get 0 i32.const 0 table.grow $t drop
table.size $t drop
i32.const 0 local.get 0 i32.const 0 table.fill $t
ref.null extern drop
local.get 0 ref.is_null drop
ref.func 0 drop
)
)
(;; STDOUT ;;;
(module
(type (;0;) (func))
(func (;0;) (type 0)
(local externref)
(drop
(table.get 0
(i32.const 0)))
(table.set 0
(i32.const 0)
(table.get 0
(i32.const 0))))
(table (;0;) 1 externref))
(local.get 0))
(drop
(table.grow 0
(local.get 0)
(i32.const 0)))
(drop
(table.size 0))
(table.fill 0
(i32.const 0)
(local.get 0)
(i32.const 0))
(drop
(ref.null extern))
(drop
(ref.is_null (local.get 0)))
(drop
(ref.func 0)))
(table (;0;) 1 externref)
(elem (;0;) declare func 0))
;;; STDOUT ;;)
Loading