summaryrefslogtreecommitdiff
path: root/test/lit/passes/merge-blocks.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/merge-blocks.wast')
-rw-r--r--test/lit/passes/merge-blocks.wast31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/lit/passes/merge-blocks.wast b/test/lit/passes/merge-blocks.wast
new file mode 100644
index 000000000..0a1defab5
--- /dev/null
+++ b/test/lit/passes/merge-blocks.wast
@@ -0,0 +1,31 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+;; RUN: wasm-opt %s --merge-blocks -all -S -o - \
+;; RUN: | filecheck %s
+
+(module
+ (type $anyref_=>_none (func (param anyref)))
+ ;; CHECK: (func $br_on_to_drop
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block $label$1 (result (ref null i31))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (br_on_i31 $label$1
+ ;; CHECK-NEXT: (ref.null any)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (ref.null i31)
+ (func $br_on_to_drop
+ (nop) ;; ensure a block at the function level
+ (drop
+ (block $label$1 (result (ref null i31)) ;; this block type must stay, we
+ ;; cannot remove it due to the br_on
+ (drop
+ (br_on_i31 $label$1
+ (ref.null any)
+ )
+ )
+ (ref.null i31) ;; this must not end up dropped
+ )
+ )
+ )
+)