summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/MergeBlocks.cpp2
-rw-r--r--test/passes/merge-blocks.txt13
-rw-r--r--test/passes/merge-blocks.wast13
3 files changed, 27 insertions, 1 deletions
diff --git a/src/passes/MergeBlocks.cpp b/src/passes/MergeBlocks.cpp
index 455e54971..d32948bee 100644
--- a/src/passes/MergeBlocks.cpp
+++ b/src/passes/MergeBlocks.cpp
@@ -213,7 +213,7 @@ static void optimizeBlock(Block* curr, Module* module) {
break;
}
}
- if (changed) curr->finalize();
+ if (changed) curr->finalize(curr->type);
}
void BreakValueDropper::visitBlock(Block* curr) {
diff --git a/test/passes/merge-blocks.txt b/test/passes/merge-blocks.txt
index dd496df2f..545438b1d 100644
--- a/test/passes/merge-blocks.txt
+++ b/test/passes/merge-blocks.txt
@@ -87,4 +87,17 @@
)
)
)
+ (func $drop-block-squared-iloop (type $0)
+ (drop
+ (block $label$0 (result i32)
+ (block $label$1
+ (drop
+ (loop $label$2
+ (br $label$2)
+ )
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/passes/merge-blocks.wast b/test/passes/merge-blocks.wast
index 4b2f248e2..e998060c4 100644
--- a/test/passes/merge-blocks.wast
+++ b/test/passes/merge-blocks.wast
@@ -69,5 +69,18 @@
)
)
)
+ (func $drop-block-squared-iloop
+ (drop
+ (block $label$0 (result i32) ;; this block's type should not change, so the drop remains none and valid
+ (drop
+ (block $label$1
+ (loop $label$2
+ (br $label$2)
+ )
+ )
+ )
+ )
+ )
+ )
)