diff options
Diffstat (limited to 'test')
6 files changed, 179 insertions, 97 deletions
diff --git a/test/binaryen.js/inlining-options.js b/test/binaryen.js/inlining-options.js index c2913e83d..bc716bf91 100644 --- a/test/binaryen.js/inlining-options.js +++ b/test/binaryen.js/inlining-options.js @@ -10,6 +10,6 @@ console.log("// oneCallerInlineMaxSize=" + binaryen.getOneCallerInlineMaxSize()) binaryen.setOneCallerInlineMaxSize(33); assert(binaryen.getOneCallerInlineMaxSize() == 33); -console.log("// allowHeavyweight=" + binaryen.getAllowHeavyweight()); -binaryen.setAllowHeavyweight(true); -assert(binaryen.getAllowHeavyweight() == true); +console.log("// allowInliningFunctionsWithLoops=" + binaryen.getAllowInliningFunctionsWithLoops()); +binaryen.setAllowInliningFunctionsWithLoops(true); +assert(binaryen.getAllowInliningFunctionsWithLoops() == true); diff --git a/test/binaryen.js/inlining-options.js.txt b/test/binaryen.js/inlining-options.js.txt index 8dc7d5cf1..b32073a1a 100644 --- a/test/binaryen.js/inlining-options.js.txt +++ b/test/binaryen.js/inlining-options.js.txt @@ -1,4 +1,4 @@ // alwaysInlineMaxSize=2 // flexibleInlineMaxSize=20 // oneCallerInlineMaxSize=15 -// allowHeavyweight=false +// allowInliningFunctionsWithLoops=false diff --git a/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt b/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt new file mode 100644 index 000000000..023709819 --- /dev/null +++ b/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt @@ -0,0 +1,95 @@ +(module + (type $i32_=>_i32 (func (param i32) (result i32))) + (memory $memory 0) + (export "fib" (func $fib)) + (export "looped" (func $looped)) + (export "t0" (func $looped)) + (export "t1" (func $t1)) + (export "t2" (func $t2)) + (export "t3" (func $t3)) + (export "memory" (memory $memory)) + (func $fib (; has Stack IR ;) (param $0 i32) (result i32) + (if + (i32.le_s + (local.get $0) + (i32.const 2) + ) + (return + (local.get $0) + ) + ) + (i32.add + (call $fib + (i32.sub + (local.get $0) + (i32.const 1) + ) + ) + (call $fib + (i32.sub + (local.get $0) + (i32.const 2) + ) + ) + ) + ) + (func $looped (; has Stack IR ;) (param $0 i32) (result i32) + (loop $L0 + (if + (i32.ge_s + (local.get $0) + (i32.const 0) + ) + (block + (local.set $0 + (i32.sub + (local.get $0) + (i32.const 1) + ) + ) + (br $L0) + ) + ) + ) + (local.get $0) + ) + (func $t1 (; has Stack IR ;) (param $0 i32) (result i32) + (local.set $0 + (i32.add + (local.get $0) + (i32.const 1) + ) + ) + (loop $L0 + (if + (i32.ge_s + (local.get $0) + (i32.const 0) + ) + (block + (local.set $0 + (i32.sub + (local.get $0) + (i32.const 1) + ) + ) + (br $L0) + ) + ) + ) + (local.get $0) + ) + (func $t2 (; has Stack IR ;) (param $0 i32) (result i32) + (call $fib + (local.get $0) + ) + ) + (func $t3 (; has Stack IR ;) (param $0 i32) (result i32) + (call $fib + (i32.add + (local.get $0) + (i32.const 1) + ) + ) + ) +) diff --git a/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast b/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast new file mode 100644 index 000000000..b1085b922 --- /dev/null +++ b/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast @@ -0,0 +1,80 @@ +(module + (type $t0 (func (param i32) (result i32))) + (func $fib (export "fib") (type $t0) (param $p0 i32) (result i32) + (if $I0 + (i32.le_s + (local.get $p0) + (i32.const 2) + ) + (then + (return + (local.get $p0) + ) + ) + ) + (i32.add + (call $fib + (i32.sub + (local.get $p0) + (i32.const 1) + ) + ) + (call $fib + (i32.sub + (local.get $p0) + (i32.const 2) + ) + ) + ) + ) + (func $looped (export "looped") (type $t0) (param $p0 i32) (result i32) + (loop $L0 + (if $I1 + (i32.ge_s + (local.get $p0) + (i32.const 0) + ) + (then + (local.set $p0 + (i32.sub + (local.get $p0) + (i32.const 1) + ) + ) + (br $L0) + ) + ) + ) + (local.get $p0) + ) + + (func $t0 (export "t0") (type $t0) (param $p0 i32) (result i32) + (call $looped + (local.get $p0) + ) + ) + + (func $t1 (export "t1") (type $t0) (param $p0 i32) (result i32) + (call $looped + (i32.add + (local.get $p0) + (i32.const 1) + ) + ) + ) + (func $t2 (export "t2") (type $t0) (param $p0 i32) (result i32) + (call $fib + (local.get $p0) + ) + ) + + (func $t3 (export "t3") (type $t0) (param $p0 i32) (result i32) + (call $fib + (i32.add + (local.get $p0) + (i32.const 1) + ) + ) + ) + (memory $memory (export "memory") 0) +) diff --git a/test/passes/O3_inline-heavyweight-functions_flexible-inline-max-function-size=30.txt b/test/passes/O3_inline-heavyweight-functions_flexible-inline-max-function-size=30.txt deleted file mode 100644 index 685ba4513..000000000 --- a/test/passes/O3_inline-heavyweight-functions_flexible-inline-max-function-size=30.txt +++ /dev/null @@ -1,54 +0,0 @@ -(module - (type $i32_=>_i32 (func (param i32) (result i32))) - (memory $memory 0) - (export "test" (func $test)) - (export "t0" (func $test)) - (export "t1" (func $t1)) - (export "memory" (memory $memory)) - (func $test (; has Stack IR ;) (param $0 i32) (result i32) - (loop $L0 - (if - (i32.ge_s - (local.get $0) - (i32.const 0) - ) - (block - (local.set $0 - (i32.sub - (local.get $0) - (i32.const 1) - ) - ) - (br $L0) - ) - ) - ) - (local.get $0) - ) - (func $t1 (; has Stack IR ;) (param $0 i32) (result i32) - (local.set $0 - (i32.add - (local.get $0) - (i32.const 1) - ) - ) - (loop $L0 - (if - (i32.ge_s - (local.get $0) - (i32.const 0) - ) - (block - (local.set $0 - (i32.sub - (local.get $0) - (i32.const 1) - ) - ) - (br $L0) - ) - ) - ) - (local.get $0) - ) -) diff --git a/test/passes/O3_inline-heavyweight-functions_flexible-inline-max-function-size=30.wast b/test/passes/O3_inline-heavyweight-functions_flexible-inline-max-function-size=30.wast deleted file mode 100644 index ec8e5bfe5..000000000 --- a/test/passes/O3_inline-heavyweight-functions_flexible-inline-max-function-size=30.wast +++ /dev/null @@ -1,39 +0,0 @@ -(module - (type $t0 (func (param i32) (result i32))) - (func $test (export "test") (type $t0) (param $p0 i32) (result i32) - (loop $L0 - (if $I1 - (i32.ge_s - (local.get $p0) - (i32.const 0) - ) - (then - (local.set $p0 - (i32.sub - (local.get $p0) - (i32.const 1) - ) - ) - (br $L0) - ) - ) - ) - (local.get $p0) - ) - - (func $t0 (export "t0") (type $t0) (param $p0 i32) (result i32) - (call $test - (local.get $p0) - ) - ) - - (func $t1 (export "t1") (type $t0) (param $p0 i32) (result i32) - (call $test - (i32.add - (local.get $p0) - (i32.const 1) - ) - ) - ) - (memory $memory (export "memory") 0) -) |