diff --git a/src/passes/InstrumentFunctions.cpp b/src/passes/InstrumentFunctions.cpp index 0c45e756577..0842cb4ca6e 100644 --- a/src/passes/InstrumentFunctions.cpp +++ b/src/passes/InstrumentFunctions.cpp @@ -251,10 +251,12 @@ struct InstrumentFunctions void addLogCallImport(Module* module) { // Add import of external log function - auto loggerFunctionImport = - Builder::makeFunction(m_LoggerFunctionName, - Signature(Type{Type::i32, Type::i32}, Type::none), - {}); + auto loggerFunctionImport = Builder::makeFunction( + m_LoggerFunctionName, + Type(Signature(Type{Type::i32, Type::i32}, Type::none), + NonNullable, + Inexact), + {}); loggerFunctionImport->base = m_LoggerFunctionName; loggerFunctionImport->module = m_ImportModule; diff --git a/test/passes/instrument-functions=a;Submodule 1;b;Submodule 1;c;Submodule 1;d;Submodule 1;e;Submodule 1;f;Submodule 2;h;Submodule 3_pass-arg=instrument-functions-labels-in-data_enable-simd.txt b/test/passes/instrument-functions=a;Submodule 1;b;Submodule 1;c;Submodule 1;d;Submodule 1;e;Submodule 1;f;Submodule 2;h;Submodule 3_pass-arg=instrument-functions-labels-in-data_enable-simd.txt new file mode 100644 index 00000000000..7e2c9b54168 --- /dev/null +++ b/test/passes/instrument-functions=a;Submodule 1;b;Submodule 1;c;Submodule 1;d;Submodule 1;e;Submodule 1;f;Submodule 2;h;Submodule 3_pass-arg=instrument-functions-labels-in-data_enable-simd.txt @@ -0,0 +1,99 @@ +(module + (type $2 (func (result i64))) + (type $0 (func)) + (type $1 (func (result i32))) + (type $3 (func (result f32))) + (type $4 (func (result f64))) + (type $6 (func (param i32) (result i32))) + (type $5 (func (result v128))) + (type $7 (func (param i32 i32))) + (import "env" "log_execution" (func $log_execution (param i32 i32))) + (memory $0 256 256) + (data $.ro-data0 (i32.const 0) "Hello World\00") + (data $label_0 (i32.const 12) "Submodule 1\00") + (data $label_1 (i32.const 24) "Submodule 2\00") + (data $label_2 (i32.const 36) "Submodule 3\00") + (export "a" (func $a)) + (export "b" (func $b)) + (export "c" (func $c)) + (export "d" (func $d)) + (export "e" (func $e)) + (export "f" (func $f)) + (export "g" (func $g)) + (export "h" (func $h)) + (export "memory" (memory $0)) + (func $a + (call $log_execution + (i32.const 0) + (i32.const 12) + ) + (nop) + ) + (func $b (result i32) + (call $log_execution + (i32.const 1) + (i32.const 12) + ) + (return + (i32.const 1337) + ) + ) + (func $c (result i64) + (call $log_execution + (i32.const 2) + (i32.const 12) + ) + (return + (i64.const 1337) + ) + ) + (func $d (result f32) + (call $log_execution + (i32.const 3) + (i32.const 12) + ) + (return + (f32.const 1337) + ) + ) + (func $e (result f64) + (call $log_execution + (i32.const 4) + (i32.const 12) + ) + (return + (f64.const 1337) + ) + ) + (func $f (param $0 i32) (result i32) + (call $log_execution + (i32.const 5) + (i32.const 24) + ) + (return + (i32.const 1337) + ) + ) + (func $g (result i64) + (drop + (call $unexported_func) + ) + (return + (i64.const 1337) + ) + ) + (func $unexported_func (result i64) + (return + (i64.const 1337) + ) + ) + (func $h (result v128) + (call $log_execution + (i32.const 8) + (i32.const 36) + ) + (return + (v128.const i32x4 0x00000001 0x00000003 0x00000003 0x00000007) + ) + ) +) diff --git a/test/passes/instrument-functions=a;Submodule 1;b;Submodule 1;c;Submodule 1;d;Submodule 1;e;Submodule 1;f;Submodule 2;h;Submodule 3_pass-arg=instrument-functions-labels-in-data_enable-simd.wast b/test/passes/instrument-functions=a;Submodule 1;b;Submodule 1;c;Submodule 1;d;Submodule 1;e;Submodule 1;f;Submodule 2;h;Submodule 3_pass-arg=instrument-functions-labels-in-data_enable-simd.wast new file mode 100644 index 00000000000..a8ce411505d --- /dev/null +++ b/test/passes/instrument-functions=a;Submodule 1;b;Submodule 1;c;Submodule 1;d;Submodule 1;e;Submodule 1;f;Submodule 2;h;Submodule 3_pass-arg=instrument-functions-labels-in-data_enable-simd.wast @@ -0,0 +1,66 @@ +(module + (memory $0 256 256) + (data $.ro-data0 (i32.const 0) "Hello World\00") + (type $0 (func)) + (type $1 (func (result i32))) + (type $2 (func (result i64))) + (type $3 (func (result f32))) + (type $4 (func (result f64))) + (type $5 (func (result v128))) + (type $6 (func (param i32) (result i32))) + (export "a" (func $a)) + (export "b" (func $b)) + (export "c" (func $c)) + (export "d" (func $d)) + (export "e" (func $e)) + (export "f" (func $f)) + (export "g" (func $g)) + (export "h" (func $h)) + (export "memory" (memory $0)) + (func $a (type $0) + (nop) + ) + (func $b (type $1) + (return + (i32.const 1337) + ) + ) + (func $c (type $2) + (return + (i64.const 1337) + ) + ) + (func $d (type $3) + (return + (f32.const 1337) + ) + ) + (func $e (type $4) + (return + (f64.const 1337) + ) + ) + (func $f (type $6) + (return + (i32.const 1337) + ) + ) + (func $g (type $2) + (drop + (call $unexported_func) + ) + (return + (i64.const 1337) + ) + ) + (func $unexported_func (type $2) + (return + (i64.const 1337) + ) + ) + (func $h (type $5) + (return + (v128.const i32x4 1 3 3 7) + ) + ) +) diff --git a/test/passes/remove-functions=a;b;c;d;e;f;g;h_enable-simd.txt b/test/passes/remove-functions=a;b;c;d;e;f;g;h_enable-simd.txt new file mode 100644 index 00000000000..4324a5f42f0 --- /dev/null +++ b/test/passes/remove-functions=a;b;c;d;e;f;g;h_enable-simd.txt @@ -0,0 +1,41 @@ +(module + (type $2 (func (result i64))) + (type $0 (func)) + (type $1 (func (result i32))) + (type $3 (func (result f32))) + (type $4 (func (result f64))) + (type $6 (func (param i32) (result i32))) + (type $5 (func (result v128))) + (export "a" (func $a)) + (export "b" (func $b)) + (export "c" (func $c)) + (export "d" (func $d)) + (export "e" (func $e)) + (export "f" (func $f)) + (export "g" (func $g)) + (export "h" (func $h)) + (func $a + (return) + ) + (func $b (result i32) + (i32.const 0) + ) + (func $c (result i64) + (i64.const 0) + ) + (func $d (result f32) + (f32.const 0) + ) + (func $e (result f64) + (f64.const 0) + ) + (func $f (param $0 i32) (result i32) + (i32.const 0) + ) + (func $g (result i64) + (i64.const 0) + ) + (func $h (result v128) + (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) + ) +) diff --git a/test/passes/remove-functions=a;b;c;d;e;f;g;h_enable-simd.wast b/test/passes/remove-functions=a;b;c;d;e;f;g;h_enable-simd.wast new file mode 100644 index 00000000000..3840a8d39e0 --- /dev/null +++ b/test/passes/remove-functions=a;b;c;d;e;f;g;h_enable-simd.wast @@ -0,0 +1,64 @@ +(module + (memory 256 256) + (type $0 (func)) + (type $1 (func (result i32))) + (type $2 (func (result i64))) + (type $3 (func (result f32))) + (type $4 (func (result f64))) + (type $5 (func (result v128))) + (type $6 (func (param i32) (result i32))) + (export "a" (func $a)) + (export "b" (func $b)) + (export "c" (func $c)) + (export "d" (func $d)) + (export "e" (func $e)) + (export "f" (func $f)) + (export "g" (func $g)) + (export "h" (func $h)) + (func $a (type $0) + (nop) + ) + (func $b (type $1) + (return + (i32.const 1337) + ) + ) + (func $c (type $2) + (return + (i64.const 1337) + ) + ) + (func $d (type $3) + (return + (f32.const 1337) + ) + ) + (func $e (type $4) + (return + (f64.const 1337) + ) + ) + (func $f (type $6) + (return + (i32.const 1337) + ) + ) + (func $g (type $2) + (drop + (call $unexported_func) + ) + (return + (i64.const 1337) + ) + ) + (func $unexported_func (type $2) + (return + (i64.const 1337) + ) + ) + (func $h (type $5) + (return + (v128.const i32x4 1 3 3 7) + ) + ) +)