;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; Verify stacky non-nullable tuples binary can be parsed correctly. The wasm ;; contains code that uses pops to get a tuple and store it in a local, then ;; reads those values. The file contains this: ;; ;; (module ;; (type $A (struct (field (mut i32)))) ;; (type $B (struct (field (mut i32)) (field (mut i32)))) ;; (tag $tag$0 (param (ref $A) (ref $B))) ;; (func $foo ;; (local $temp ((ref null $A) (ref null $B))) ;; (try $label$3 ;; (do ;; (nop) ;; ) ;; (catch $tag$0 ;; (local.set $temp ;; (pop (ref $A) (ref $B)) ;; ) ;; (drop ;; (ref.as_non_null ;; (tuple.extract 0 ;; (local.get $temp) ;; ) ;; ) ;; ) ;; (drop ;; (ref.as_non_null ;; (tuple.extract 1 ;; (local.get $temp) ;; ) ;; ) ;; ) ;; (unreachable) ;; ) ;; ) ;; ) ;; ) ;; RUN: wasm-opt -all %s.wasm -all -S -o - | filecheck %s ;; CHECK: (type $0 (struct (field (mut i32)))) ;; CHECK: (type $1 (struct (field (mut i32)) (field (mut i32)))) ;; CHECK: (type $2 (func (param (ref null $0) (ref null $1)))) ;; CHECK: (type $3 (func)) ;; CHECK: (tag $tag$0 (param (ref null $0) (ref null $1))) ;; CHECK: (func $0 (type $3) ;; CHECK-NEXT: (local $0 (ref null $0)) ;; CHECK-NEXT: (local $1 (ref null $1)) ;; CHECK-NEXT: (local $2 (ref null $1)) ;; CHECK-NEXT: (local $scratch (tuple (ref null $0) (ref null $1))) ;; CHECK-NEXT: (local $scratch_4 (ref null $0)) ;; CHECK-NEXT: (local $scratch_5 (ref null $0)) ;; CHECK-NEXT: (local $scratch_6 (ref null $0)) ;; CHECK-NEXT: (local $7 (tuple (ref null $0) (ref null $1))) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $tag$0 ;; CHECK-NEXT: (local.set $7 ;; CHECK-NEXT: (pop (tuple (ref null $0) (ref null $1))) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (block (result (ref null $0)) ;; CHECK-NEXT: (local.set $scratch_4 ;; CHECK-NEXT: (tuple.extract 2 0 ;; CHECK-NEXT: (local.tee $scratch ;; CHECK-NEXT: (local.get $7) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (tuple.extract 2 1 ;; CHECK-NEXT: (local.get $scratch) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.get $scratch_4) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (block (result (ref null $0)) ;; CHECK-NEXT: (local.set $scratch_5 ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.get $scratch_5) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref null $0)) ;; CHECK-NEXT: (local.set $scratch_6 ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $2 ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.get $scratch_6) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (local.get $2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: )