summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/remove-unused-brs.txt16
-rw-r--r--test/passes/remove-unused-brs.wast14
2 files changed, 30 insertions, 0 deletions
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt
index 6991680f7..39a4d89f3 100644
--- a/test/passes/remove-unused-brs.txt
+++ b/test/passes/remove-unused-brs.txt
@@ -1121,4 +1121,20 @@
)
)
)
+ (func $unreachable-return-loop-value (type $7) (result i64)
+ (loop $loop
+ (br_if $loop
+ (i32.eqz
+ (i32.const 1)
+ )
+ )
+ (block $block
+ (br_if $block
+ (br $loop)
+ )
+ (br $loop)
+ )
+ )
+ (unreachable)
+ )
)
diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast
index 5c6776226..14b4abc4c 100644
--- a/test/passes/remove-unused-brs.wast
+++ b/test/passes/remove-unused-brs.wast
@@ -1006,5 +1006,19 @@
)
)
)
+ (func $unreachable-return-loop-value (result i64)
+ (loop $loop
+ (if
+ (i32.const 1)
+ (block $block
+ (br_if $block
+ (br $loop)
+ )
+ (br $loop)
+ )
+ )
+ (br $loop) ;; we 100% go back to the loop top, the loop is never exited. but opts move code around so that is not obvious anymore, and the loop becomes a nop, but the func has a return value
+ )
+ )
)