;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; RUN: foreach %s %t wasm-opt -all --dae-optimizing -S -o - | filecheck %s ;; The br_on_cast_fail is optimized away thanks to the refined type. The output still has some unoptimized code (an additional --dce pass would get rid of the drop-return pattern here), but that is not directly relevant to this test. (module ;; CHECK: (type $0 (func (param (ref array)) (result i32))) ;; CHECK: (func $len (type $0) (param $0 (ref array)) (result i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (return ;; CHECK-NEXT: (array.len ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $len (param (ref eq)) (result i32) (drop (block $not_array (result (ref eq)) (return (array.len (br_on_cast_fail $not_array (ref eq) (ref array) (local.get 0) ) ) ) ) ) (i32.const -1) ) ;; CHECK: (func $optimize-after-refinement (type $0) (param $0 (ref array)) (result i32) ;; CHECK-NEXT: (call $len ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $optimize-after-refinement (param (ref array)) (result i32) (call $len (local.get 0) ) ) )