;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. ;; RUN: wasm-opt %s -all --ssa -S -o - | filecheck %s (module ;; CHECK: (type $A (struct )) (type $A (struct )) ;; CHECK: (func $foo (type $1) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $foo) ;; CHECK: (func $bar (type $2) (param $x (ref func)) ;; CHECK-NEXT: (local $1 (ref func)) ;; CHECK-NEXT: (local $2 (ref func)) ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (ref.func $foo) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $2 ;; CHECK-NEXT: (ref.func $bar) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $bar (param $x (ref func)) ;; assign a non-nullable parameter multiple times, which causes ssa to create ;; new locals so that each is assigned only once (local.set $x (ref.func $foo)) (drop (local.get $x)) (local.set $x (ref.func $bar)) (drop (local.get $x)) ) ;; CHECK: (func $refine-to-null (type $3) (result (ref $A)) ;; CHECK-NEXT: (local $0 (ref null $A)) ;; CHECK-NEXT: (block $label (result (ref none)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (br_on_cast $label nullref (ref none) ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $refine-to-null (result (ref $A)) (local $0 (ref null $A)) (block $label (result (ref $A)) (drop (br_on_cast $label (ref null $A) (ref $A) ;; This will turn into a null, which has a more refined type that affects ;; the br_on_cast parent. (local.get $0) ) ) (unreachable) ) ) )