Optimize out memory and table when possible (#1352)
We can remove the memory/table (itself, or an import if imported) if they are not used. This is pretty minor on a large wasm file, but when reading small wasts it's very noticeable to have an unused memory and table all the time.
diff --git a/test/min.fromasm.clamp.no-opts b/test/min.fromasm.clamp.no-opts
index 0257921..7586e5f 100644
--- a/test/min.fromasm.clamp.no-opts
+++ b/test/min.fromasm.clamp.no-opts
@@ -1,9 +1,9 @@
(module
- (import "env" "tempDoublePtr" (global $tDP$asm2wasm$import i32))
(import "env" "memory" (memory $0 256 256))
(import "env" "table" (table 0 0 anyfunc))
(import "env" "memoryBase" (global $memoryBase i32))
(import "env" "tableBase" (global $tableBase i32))
+ (import "env" "tempDoublePtr" (global $tDP$asm2wasm$import i32))
(global $tDP (mut i32) (get_global $tDP$asm2wasm$import))
(global $M (mut i32) (i32.const 0))
(export "floats" (func $legalstub$floats))