summaryrefslogtreecommitdiff
path: root/src/ir/hashed.h
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 /src/ir/hashed.h
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 'src/ir/hashed.h')
-rw-r--r--src/ir/hashed.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ir/hashed.h b/src/ir/hashed.h
index b15342aba..61bf19478 100644
--- a/src/ir/hashed.h
+++ b/src/ir/hashed.h
@@ -26,7 +26,7 @@ namespace wasm {
// An expression with a cached hash value
struct HashedExpression {
Expression* expr;
- size_t hash;
+ HashType hash;
HashedExpression(Expression* expr) : expr(expr) {
if (expr) {
@@ -38,7 +38,7 @@ struct HashedExpression {
};
struct ExpressionHasher {
- size_t operator()(const HashedExpression value) const {
+ HashType operator()(const HashedExpression value) const {
return value.hash;
}
};