;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. ;; Optimize the code, flatten, and run a pass that will verify it is properly ;; flat. ;; RUN: wasm-opt %s -all -O1 --flatten --rereloop -S -o - | filecheck %s (module ;; CHECK: (export "foo" (func $foo)) (export "foo" (func $foo)) ;; CHECK: (func $foo (type $0) (result funcref) ;; CHECK-NEXT: (local $0 funcref) ;; CHECK-NEXT: (local $1 (ref $0)) ;; CHECK-NEXT: (local $2 (ref $0)) ;; CHECK-NEXT: (local $3 i32) ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (ref.func $foo) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $2 ;; CHECK-NEXT: (local.get $1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return ;; CHECK-NEXT: (local.get $2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $foo (result funcref) ;; the resulting ref.as_non_nulls here must be validated as ok in flat mode. (drop (call $foo) ) (ref.func $foo) ) )