| ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. |
| |
| ;; RUN: foreach %s %t wasm-opt -all --deinstrument-branch-hints -S -o - | filecheck %s |
| |
| (module |
| ;; CHECK: (type $0 (func)) |
| |
| ;; CHECK: (type $1 (func (param i32 i32 i32) (result i32))) |
| |
| ;; CHECK: (import "fuzzing-support" "log-branch" (func $log (type $1) (param i32 i32 i32) (result i32))) |
| (import "fuzzing-support" "log-branch" (func $log (param i32 i32 i32) (result i32))) |
| |
| ;; CHECK: (func $if (type $0) |
| ;; CHECK-NEXT: (@metadata.code.branch_hint "\00") |
| ;; CHECK-NEXT: (if |
| ;; CHECK-NEXT: (i32.const 42) |
| ;; CHECK-NEXT: (then |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (i32.const 1337) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (else |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (i32.const 99) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $if |
| ;; The instrumentation should be removed, and the if's condition should |
| ;; be 42. |
| (@metadata.code.branch_hint "\00") |
| (if |
| (call $log |
| (i32.const 42) |
| (i32.const 0) |
| (i32.const 1) |
| ) |
| (then |
| (drop |
| (i32.const 1337) |
| ) |
| ) |
| (else |
| (drop |
| (i32.const 99) |
| ) |
| ) |
| ) |
| ) |
| |
| ;; CHECK: (func $br (type $0) |
| ;; CHECK-NEXT: (block $out |
| ;; CHECK-NEXT: (@metadata.code.branch_hint "\01") |
| ;; CHECK-NEXT: (br_if $out |
| ;; CHECK-NEXT: (i32.const 42) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $br |
| ;; The same, with a br. |
| (block $out |
| (@metadata.code.branch_hint "\01") |
| (br_if $out |
| (call $log |
| (i32.const 42) |
| (i32.const 0) |
| (i32.const 4) |
| ) |
| ) |
| ) |
| ) |
| ) |