| ;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. |
| ;; RUN: wasm-opt %s -all --optimize-instructions -S -o - | filecheck %s |
| |
| (module |
| ;; CHECK: (func $string.checks (type $0) (param $a (ref string)) (param $b (ref string)) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (string.eq |
| ;; CHECK-NEXT: (local.get $a) |
| ;; CHECK-NEXT: (local.get $b) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (i32.and |
| ;; CHECK-NEXT: (string.compare |
| ;; CHECK-NEXT: (local.get $a) |
| ;; CHECK-NEXT: (local.get $b) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (i32.const 1) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $string.checks (param $a (ref string)) (param $b (ref string)) |
| ;; Equals returns 0/1, so the &1 operation can be removed. |
| (drop |
| (i32.and |
| (string.eq |
| (local.get $a) |
| (local.get $b) |
| ) |
| (i32.const 1) |
| ) |
| ) |
| ;; Compare returns -1/0/1, so we cannot change anything here. |
| (drop |
| (i32.and |
| (string.compare |
| (local.get $a) |
| (local.get $b) |
| ) |
| (i32.const 1) |
| ) |
| ) |
| ) |
| ) |