;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s --vacuum -all -S -o - | filecheck %s

(module
 ;; CHECK:      (type $func (func (param i32)))
 (type $func (func (param i32)))

 ;; CHECK:      (import "fuzzing-support" "log-i32" (func $import (type $func) (param i32)))
 (import "fuzzing-support" "log-i32" (func $import (param i32)))

 ;; CHECK:      (tag $tag (type $func) (param i32))
 (tag $tag (type $func) (param i32))

 ;; CHECK:      (func $test (type $1) (result i32)
 ;; CHECK-NEXT:  (local $0 i32)
 ;; CHECK-NEXT:  (block $block (result i32)
 ;; CHECK-NEXT:   (try
 ;; CHECK-NEXT:    (do
 ;; CHECK-NEXT:     (call $import
 ;; CHECK-NEXT:      (i32.const 0)
 ;; CHECK-NEXT:     )
 ;; CHECK-NEXT:    )
 ;; CHECK-NEXT:    (catch $tag
 ;; CHECK-NEXT:     (local.set $0
 ;; CHECK-NEXT:      (pop i32)
 ;; CHECK-NEXT:     )
 ;; CHECK-NEXT:     (drop
 ;; CHECK-NEXT:      (block
 ;; CHECK-NEXT:       (drop
 ;; CHECK-NEXT:        (local.get $0)
 ;; CHECK-NEXT:       )
 ;; CHECK-NEXT:       (unreachable)
 ;; CHECK-NEXT:      )
 ;; CHECK-NEXT:     )
 ;; CHECK-NEXT:    )
 ;; CHECK-NEXT:   )
 ;; CHECK-NEXT:   (i32.const 1)
 ;; CHECK-NEXT:  )
 ;; CHECK-NEXT: )
 (func $test (result i32)
  (block $block (result i32)
   ;; Vacuum cannot simplify the body here, but it will make a change to the
   ;; unreachable br_if, replacing it with its dropped children (as the branch
   ;; is untaken, and we want to remove that reference to $block). While doing
   ;; so we must update the IR to handle the pop.
   (try
    (do
     (call $import
      (i32.const 0)
     )
    )
    (catch $tag
     (drop
      (br_if $block
       (pop i32)
       (unreachable)
      )
     )
    )
   )
   (i32.const 1)
  )
 )
)

