diff options
Diffstat (limited to 'test/passes/remove-unused-module-elements.wast')
-rw-r--r-- | test/passes/remove-unused-module-elements.wast | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/passes/remove-unused-module-elements.wast b/test/passes/remove-unused-module-elements.wast index 2d4b51f1b..dfefd7b91 100644 --- a/test/passes/remove-unused-module-elements.wast +++ b/test/passes/remove-unused-module-elements.wast @@ -218,4 +218,47 @@ (drop (i32.const 0)) ) ) +(module ;; the function and the table can be removed + (type $0 (func (param f64) (result f64))) + (table 6 6 anyfunc) + (func $0 (; 0 ;) (type $0) (param $var$0 f64) (result f64) + (if (result f64) + (f64.eq + (f64.const 1) + (f64.const 1) + ) + (f64.const 1) + (f64.const 0) + ) + ) +) +(module ;; the function uses the table, but all are removeable + (type $0 (func (param f64) (result f64))) + (table 6 6 anyfunc) + (func $0 (; 0 ;) (type $0) (param $var$0 f64) (result f64) + (if (result f64) + (f64.eq + (f64.const 1) + (f64.const 1) + ) + (call_indirect (type $0) (f64.const 1) (i32.const 0)) + (f64.const 0) + ) + ) +) +(module ;; the table is imported - we can't remove it + (type $0 (func (param f64) (result f64))) + (import "env" "table" (table 6 6 anyfunc)) + (elem (i32.const 0) $0) + (func $0 (; 0 ;) (type $0) (param $var$0 f64) (result f64) + (if (result f64) + (f64.eq + (f64.const 1) + (f64.const 1) + ) + (f64.const 1) + (f64.const 0) + ) + ) +) |