summaryrefslogtreecommitdiff
path: root/src/passes/RemoveUnusedBrs.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-07-12 19:27:17 -0700
committerGitHub <noreply@github.com>2017-07-12 19:27:17 -0700
commitb2c17a105e9fbe86c059793032ee0be676245a8a (patch)
tree72cf9673e9de93c4c3106612416ebd9e0329a19c /src/passes/RemoveUnusedBrs.cpp
parent25cbf641c6133d5156e8591072d2705fde92752b (diff)
parent6159fb42fcd2dae593ee61ebb7e3e163445ae9d0 (diff)
downloadbinaryen-b2c17a105e9fbe86c059793032ee0be676245a8a.tar.gz
binaryen-b2c17a105e9fbe86c059793032ee0be676245a8a.tar.bz2
binaryen-b2c17a105e9fbe86c059793032ee0be676245a8a.zip
Merge pull request #1087 from WebAssembly/fuzz-2
Fuzz fixes
Diffstat (limited to 'src/passes/RemoveUnusedBrs.cpp')
-rw-r--r--src/passes/RemoveUnusedBrs.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp
index 1fa996ae6..b725de901 100644
--- a/src/passes/RemoveUnusedBrs.cpp
+++ b/src/passes/RemoveUnusedBrs.cpp
@@ -21,6 +21,8 @@
#include <wasm.h>
#include <pass.h>
#include <ast_utils.h>
+#include <ast/branch-utils.h>
+#include <ast/effects.h>
#include <wasm-builder.h>
namespace wasm {
@@ -257,7 +259,7 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> {
// so only do it if it looks useful, which it definitely is if
// (a) $somewhere is straight out (so the br out vanishes), and
// (b) this br_if is the only branch to that block (so the block will vanish)
- if (brIf->name == block->name && BreakSeeker::count(block, block->name) == 1) {
+ if (brIf->name == block->name && BranchUtils::BranchSeeker::countNamed(block, block->name) == 1) {
// note that we could drop the last element here, it is a br we know for sure is removable,
// but telling stealSlice to steal all to the end is more efficient, it can just truncate.
list[i] = builder.makeIf(brIf->condition, builder.makeBreak(brIf->name), builder.stealSlice(block, i + 1, list.size()));
@@ -447,7 +449,7 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> {
auto* br = list[0]->dynCast<Break>();
if (br && br->condition && br->name == curr->name) {
assert(!br->value); // can't, it would be dropped or last in the block
- if (BreakSeeker::count(curr, curr->name) == 1) {
+ if (BranchUtils::BranchSeeker::countNamed(curr, curr->name) == 1) {
// no other breaks to that name, so we can do this
Builder builder(*getModule());
replaceCurrent(builder.makeIf(