diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-09-07 10:55:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-07 10:55:02 -0700 |
commit | 135a20cd110d356d5d098a08a7b447205adaed7a (patch) | |
tree | f5200a6b35f19d1bf95dea1fa7e339f40391413b /src/passes/RemoveUnusedNames.cpp | |
parent | fbe77b167002e8a49225b607ca8c37dc7e4b41fe (diff) | |
parent | dd197d3212ac28e778d372df9d03e58b21386648 (diff) | |
download | binaryen-135a20cd110d356d5d098a08a7b447205adaed7a.tar.gz binaryen-135a20cd110d356d5d098a08a7b447205adaed7a.tar.bz2 binaryen-135a20cd110d356d5d098a08a7b447205adaed7a.zip |
Merge pull request #678 from WebAssembly/stack
Stack machine + 0xc update
Diffstat (limited to 'src/passes/RemoveUnusedNames.cpp')
-rw-r--r-- | src/passes/RemoveUnusedNames.cpp | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/passes/RemoveUnusedNames.cpp b/src/passes/RemoveUnusedNames.cpp index 9c6743479..8e24f9549 100644 --- a/src/passes/RemoveUnusedNames.cpp +++ b/src/passes/RemoveUnusedNames.cpp @@ -76,34 +76,12 @@ struct RemoveUnusedNames : public WalkerPass<PostWalker<RemoveUnusedNames, Visit } } handleBreakTarget(curr->name); - if (curr->name.is() && curr->list.size() == 1) { - auto* child = curr->list[0]->dynCast<Loop>(); - if (child && !child->out.is()) { - // we have just one child, this loop, and it lacks an out label. So this block's name is doing just that! - child->out = curr->name; - replaceCurrent(child); - } - } } void visitLoop(Loop *curr) { - handleBreakTarget(curr->in); - // Loops can have just 'in', but cannot have just 'out' - auto out = curr->out; - handleBreakTarget(curr->out); - if (curr->out.is() && !curr->in.is()) { - auto* block = getModule()->allocator.alloc<Block>(); - block->name = out; - block->list.push_back(curr->body); - replaceCurrent(block); - } - if (curr->in.is() && !curr->out.is()) { - auto* child = curr->body->dynCast<Block>(); - if (child && child->name.is()) { - // we have just one child, this block, and we lack an out label. So we can take the block's! - curr->out = child->name; - child->name = Name(); - } + handleBreakTarget(curr->name); + if (!curr->name.is()) { + replaceCurrent(curr->body); } } |