diff options
-rw-r--r-- | src/passes/Inlining.cpp | 3 | ||||
-rw-r--r-- | test/passes/inlining_all-features.txt | 12 | ||||
-rw-r--r-- | test/passes/inlining_all-features.wast | 11 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/passes/Inlining.cpp b/src/passes/Inlining.cpp index 43addff8b..5c94755d1 100644 --- a/src/passes/Inlining.cpp +++ b/src/passes/Inlining.cpp @@ -343,6 +343,9 @@ struct Inlining : public Pass { } } } + if (module->start.is()) { + infos[module->start].usedGlobally = true; + } } bool iteration(PassRunner* runner, Module* module) { diff --git a/test/passes/inlining_all-features.txt b/test/passes/inlining_all-features.txt index 2141d3d34..e909239d2 100644 --- a/test/passes/inlining_all-features.txt +++ b/test/passes/inlining_all-features.txt @@ -59,3 +59,15 @@ ) ) ) +(module + (type $none_=>_none (func)) + (start $0) + (func $0 + (nop) + ) + (func $1 + (block $__inlined_func$0 + (nop) + ) + ) +) diff --git a/test/passes/inlining_all-features.wast b/test/passes/inlining_all-features.wast index f86ad8926..60093cb63 100644 --- a/test/passes/inlining_all-features.wast +++ b/test/passes/inlining_all-features.wast @@ -47,3 +47,14 @@ (call $0) ) ) +(module + ;; a function reference in the start should be noticed, and prevent us + ;; from removing an inlined function + (start $0) + (func $0 + (nop) + ) + (func $1 + (call $0) + ) +) |