summaryrefslogtreecommitdiff
path: root/test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2020-09-05 04:30:25 +0300
committerGitHub <noreply@github.com>2020-09-04 18:30:25 -0700
commit8b436ba3046deb69e5b736a6cef003b8b0dde0c0 (patch)
tree2259b0139e1bcc310475e2b4f8615b8167a24309 /test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt
parent44df23efd69fd2dd4c260755c82ddede226c40ff (diff)
downloadbinaryen-8b436ba3046deb69e5b736a6cef003b8b0dde0c0.tar.gz
binaryen-8b436ba3046deb69e5b736a6cef003b8b0dde0c0.tar.bz2
binaryen-8b436ba3046deb69e5b736a6cef003b8b0dde0c0.zip
Improve inlining "heavyweight" (#3085)
Split that mode into an option to check for loops (which indicate a function is "heavy") and a constant check for having calls. The case of calls is different as we would need more logic to avoid infinite recursion if we are willing to inling functions with calls. Practically, this renames allowHeavyweight to allowFunctionsWithLoops.
Diffstat (limited to 'test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt')
-rw-r--r--test/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.txt95
1 files changed, 95 insertions, 0 deletions
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)
+ )
+ )
+ )
+)