1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
(module
(export "a8" (func $a8))
(table 1 1 funcref)
(elem (i32.const 0) $a9)
(func $a (param $x i32))
(func $b
(call $a (i32.const 1)) ;; best case scenario
)
(func $a1 (param $x i32)
(unreachable)
)
(func $b1
(call $a1 (i32.const 2)) ;; same value in both, so works
)
(func $b11
(call $a1 (i32.const 2))
)
(func $a2 (param $x i32)
(drop (local.get $x))
)
(func $b2
(call $a2 (i32.const 3)) ;; different value!
)
(func $b22
(call $a2 (i32.const 4))
)
(func $a3 (param $x i32)
(drop (i32.const -1)) ;; diff value, but at least unused, so no need to send
)
(func $b3
(call $a3 (i32.const 3))
)
(func $b33
(call $a3 (i32.const 4))
)
(func $a4 (param $x i32) ;; diff value, but with effects
)
(func $b4
(call $a4 (unreachable))
)
(func $b43
(call $a4 (i32.const 4))
)
(func $a5 (param $x i32) (param $y f64) ;; optimize two
(drop (local.get $x))
(drop (local.get $y))
)
(func $b5
(call $a5 (i32.const 1) (f64.const 3.14159))
)
(func $a6 (param $x i32) (param $y f64) ;; optimize just one
(drop (local.get $x))
(drop (local.get $y))
)
(func $b6
(call $a6 (unreachable) (f64.const 3.14159))
)
(func $a7 (param $x i32) (param $y f64) ;; optimize just the other one
(drop (local.get $x))
(drop (local.get $y))
)
(func $b7
(call $a7 (i32.const 1) (unreachable))
)
(func $a8 (param $x i32)) ;; exported, do not optimize
(func $b8
(call $a8 (i32.const 1))
)
(func $a9 (param $x i32)) ;; tabled, do not optimize
(func $b9
(call $a9 (i32.const 1))
)
(func $a10 (param $x i32) ;; recursion
(call $a10 (i32.const 1))
(call $a10 (i32.const 1))
)
(func $a11 (param $x i32) ;; partially successful recursion
(call $a11 (i32.const 1))
(call $a11 (i32.const 2))
)
(func $a12 (param $x i32) ;; unsuccessful recursion
(drop (local.get $x))
(call $a12 (i32.const 1))
(call $a12 (i32.const 2))
)
)
|