;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s --merge-blocks -all -S -o - | filecheck %s
;;
;; Similar to merge-blocks.wast, but without --remove-unused-names. This tests
;; the pass entirely by itself.

(module
 ;; CHECK:      (func $nested-dropped-blocks (type $0)
 ;; CHECK-NEXT:  (drop
 ;; CHECK-NEXT:   (i32.const 42)
 ;; CHECK-NEXT:  )
 ;; CHECK-NEXT: )
 (func $nested-dropped-blocks
  ;; Fully removing unneeded blocks here requires multiple operations to happen.
  ;; Specifically, we remove all the outer blocks first, and only then get to
  ;; the inner named block, which we can then infer is not needed either.
  (block
   (drop
    (block (result i32)
     (block $named (result i32)
      (i32.const 42)
     )
    )
   )
  )
 )
)

