summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai (kripken) <alonzakai@gmail.com>2017-08-04 19:43:20 -0700
committerAlon Zakai (kripken) <alonzakai@gmail.com>2017-08-05 13:45:43 -0700
commit6303389c7540aaa4e52b61c732cb65d04d6585e4 (patch)
tree2bbf4f78282e2248619f2f85d557fac378615ad2 /src
parent5b9fff4399b959a4af28a6c82e8ab9243898f360 (diff)
downloadbinaryen-6303389c7540aaa4e52b61c732cb65d04d6585e4.tar.gz
binaryen-6303389c7540aaa4e52b61c732cb65d04d6585e4.tar.bz2
binaryen-6303389c7540aaa4e52b61c732cb65d04d6585e4.zip
merge blocks in remove-unused-names only when their type is identical, so branches to them are interchangeable
Diffstat (limited to 'src')
-rw-r--r--src/passes/RemoveUnusedNames.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/passes/RemoveUnusedNames.cpp b/src/passes/RemoveUnusedNames.cpp
index 39bf068df..e5aaf5509 100644
--- a/src/passes/RemoveUnusedNames.cpp
+++ b/src/passes/RemoveUnusedNames.cpp
@@ -57,7 +57,7 @@ struct RemoveUnusedNames : public WalkerPass<PostWalker<RemoveUnusedNames>> {
void visitBlock(Block *curr) {
if (curr->name.is() && curr->list.size() == 1) {
auto* child = curr->list[0]->dynCast<Block>();
- if (child && child->name.is()) {
+ if (child && child->name.is() && child->type == curr->type) {
// we have just one child, this block, so breaking out of it goes to the same place as breaking out of us, we just need one name (and block)
auto& branches = branchesSeen[curr->name];
for (auto* branch : branches) {