summaryrefslogtreecommitdiff
path: root/test/passes/inlining_optimize-level=3.wast
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-08-22 10:27:52 -0700
committerGitHub <noreply@github.com>2017-08-22 10:27:52 -0700
commitcfeddd741f6503457c6c4a5e1741d91eb0e7e08d (patch)
tree721d09f5ecdb8d90748244311073bdaa4ed54853 /test/passes/inlining_optimize-level=3.wast
parentad8bc65685b19c0c3323dbb0a5cf2b6f709c7b92 (diff)
downloadbinaryen-cfeddd741f6503457c6c4a5e1741d91eb0e7e08d.tar.gz
binaryen-cfeddd741f6503457c6c4a5e1741d91eb0e7e08d.tar.bz2
binaryen-cfeddd741f6503457c6c4a5e1741d91eb0e7e08d.zip
Inline many (#1125)
* Improve inlining pass to inline single-use functions that are fairly small, which makes it useful for removing unnecessary global constructors from clang. * Add an inlining-optimizing pass that also optimizes where it inlined, as new opportunities arise. enable that it by default in O2+ * In addition, in -O3+ also inline small functions with multiple uses. This helps a lot with things like safe-int-divide functions (where each int divide is replaced by a safe divide that won't trap). Inlining gets rid of around half of the overhead there.
Diffstat (limited to 'test/passes/inlining_optimize-level=3.wast')
-rw-r--r--test/passes/inlining_optimize-level=3.wast58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/passes/inlining_optimize-level=3.wast b/test/passes/inlining_optimize-level=3.wast
new file mode 100644
index 000000000..21940bc82
--- /dev/null
+++ b/test/passes/inlining_optimize-level=3.wast
@@ -0,0 +1,58 @@
+(module
+ (export "yes" (func $yes))
+ (export "no-loops-but-one-use-but-exported" (func $no-loops-but-one-use-but-exported))
+ (table 1 1 anyfunc)
+ (elem (i32.const 0) $no-loops-but-one-use-but-tabled)
+
+ (func $yes (result i32) ;; inlinable: small, lightweight, even with multi uses and a global use, ok when opt-level=3
+ (i32.const 1)
+ )
+ (func $no-tooBig (result i32)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (i32.const 1)
+ )
+ (func $no-calls (result i32)
+ (call $yes)
+ )
+ (func $yes-calls-but-one-use (result i32)
+ (call $yes)
+ )
+ (func $no-loops (result i32)
+ (loop (result i32)
+ (i32.const 1)
+ )
+ )
+ (func $yes-loops-but-one-use (result i32)
+ (loop (result i32)
+ (i32.const 1)
+ )
+ )
+ (func $no-loops-but-one-use-but-exported (result i32)
+ (loop (result i32)
+ (i32.const 1)
+ )
+ )
+ (func $no-loops-but-one-use-but-tabled (result i32)
+ (loop (result i32)
+ (i32.const 1)
+ )
+ )
+ (func $intoHere
+ (drop (call $yes))
+ (drop (call $no-tooBig))
+ (drop (call $no-calls))
+ (drop (call $no-calls))
+ (drop (call $yes-calls-but-one-use))
+ (drop (call $no-loops))
+ (drop (call $no-loops))
+ (drop (call $yes-loops-but-one-use))
+ (drop (call $no-loops-but-one-use-but-exported))
+ (drop (call $no-loops-but-one-use-but-tabled))
+ )
+)
+