summaryrefslogtreecommitdiff
path: root/test/example/c-api-unused-mem.txt
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-11-21 08:59:13 -0800
committerGitHub <noreply@github.com>2018-11-21 08:59:13 -0800
commit6cc2bb302d5729c76da42dc0815d6dbba645d952 (patch)
tree11e60856b2028e73df98eeaea2f0b789c50c8cd1 /test/example/c-api-unused-mem.txt
parent44335674936254ef6f8695883e4376a9d5fd1521 (diff)
downloadbinaryen-6cc2bb302d5729c76da42dc0815d6dbba645d952.tar.gz
binaryen-6cc2bb302d5729c76da42dc0815d6dbba645d952.tar.bz2
binaryen-6cc2bb302d5729c76da42dc0815d6dbba645d952.zip
Relooper CFG optimizations (#1759)
Previously the relooper would do some optimizations when deciding when to use an if vs a switch, how to group blocks, etc. This PR adds an additional pre-optimization phase with some basic but useful simplify-cfg style passes, * Skip empty blocks when they have just one exit. * Merge exiting branches when they are equivalent. * Canonicalize block contents to make such comparisons more useful. * Turn a trivial one-target switch into a simple branch. This can help in noticeable ways when running the rereloop pass, e.g. on LLVM wasm backend output. Also: * Binaryen C API changes to the relooper, which now gets a Module for its constructor. It needs it for the optimizations, as it may construct new nodes. * Many relooper-fuzzer improvements. * Clean up HashType usage.
Diffstat (limited to 'test/example/c-api-unused-mem.txt')
-rw-r--r--test/example/c-api-unused-mem.txt42
1 files changed, 12 insertions, 30 deletions
diff --git a/test/example/c-api-unused-mem.txt b/test/example/c-api-unused-mem.txt
index 6e67735bd..3c2301ace 100644
--- a/test/example/c-api-unused-mem.txt
+++ b/test/example/c-api-unused-mem.txt
@@ -9,32 +9,23 @@
(local $0 i32)
(local $1 i32)
(local $2 i64)
- (block $block$1$break
+ (block $block$2$break
(set_local $0
(i32.load
(i32.const 0)
)
)
(block
- (br $block$1$break)
+ (br $block$2$break)
)
)
(block
- (block $block$2$break
- (block $bb0
- )
- (block
- (br $block$2$break)
- )
- )
(block
- (block $bb1
- (i32.store
- (i32.const 0)
- (get_local $0)
- )
- (return)
+ (i32.store
+ (i32.const 0)
+ (get_local $0)
)
+ (return)
)
)
)
@@ -46,7 +37,7 @@
(call $main)
)
)
-169
+151
(module
(type $0 (func))
(type $1 (func))
@@ -70,22 +61,13 @@
)
(block $label$3
(block $label$4
- (block $label$5
- )
- (block $label$6
- (br $label$4)
- )
- )
- (block $label$7
- (block $label$8
- (i32.store
- (i32.const 0)
- (get_local $0)
- )
- (return)
+ (i32.store
+ (i32.const 0)
+ (get_local $0)
)
- (unreachable)
+ (return)
)
+ (unreachable)
)
)
(func $__wasm_start (; 1 ;) (type $1)