|
3472 | 3472 | (br $loop) |
3473 | 3473 | ) |
3474 | 3474 | ) |
| 3475 | + |
| 3476 | + ;; CHECK: (func $unreachable-loop (type $1) |
| 3477 | + ;; CHECK-NEXT: (local $x i32) |
| 3478 | + ;; CHECK-NEXT: (unreachable) |
| 3479 | + ;; CHECK-NEXT: (unreachable) |
| 3480 | + ;; CHECK-NEXT: ) |
| 3481 | + ;; OPTIN: (func $unreachable-loop (type $1) |
| 3482 | + ;; OPTIN-NEXT: (local $x i32) |
| 3483 | + ;; OPTIN-NEXT: (unreachable) |
| 3484 | + ;; OPTIN-NEXT: (unreachable) |
| 3485 | + ;; OPTIN-NEXT: ) |
| 3486 | + (func $unreachable-loop |
| 3487 | + (local $x i32) |
| 3488 | + ;; The entire loop is unreachable. The control flow here should not cause any |
| 3489 | + ;; internal errors, and we can just optimize this to unreachable. |
| 3490 | + (unreachable) |
| 3491 | + (local.set $x |
| 3492 | + (loop $loop (result i32) |
| 3493 | + (i32.const 0) |
| 3494 | + ) |
| 3495 | + ) |
| 3496 | + ) |
| 3497 | + |
| 3498 | + ;; CHECK: (func $set-silly (type $0) (param $x i32) |
| 3499 | + ;; CHECK-NEXT: (local.set $x |
| 3500 | + ;; CHECK-NEXT: (local.get $x) |
| 3501 | + ;; CHECK-NEXT: ) |
| 3502 | + ;; CHECK-NEXT: (if |
| 3503 | + ;; CHECK-NEXT: (i32.const 0) |
| 3504 | + ;; CHECK-NEXT: (then |
| 3505 | + ;; CHECK-NEXT: ) |
| 3506 | + ;; CHECK-NEXT: ) |
| 3507 | + ;; CHECK-NEXT: ) |
| 3508 | + ;; OPTIN: (func $set-silly (type $0) (param $x i32) |
| 3509 | + ;; OPTIN-NEXT: (local.set $x |
| 3510 | + ;; OPTIN-NEXT: (local.get $x) |
| 3511 | + ;; OPTIN-NEXT: ) |
| 3512 | + ;; OPTIN-NEXT: (if |
| 3513 | + ;; OPTIN-NEXT: (i32.const 0) |
| 3514 | + ;; OPTIN-NEXT: (then |
| 3515 | + ;; OPTIN-NEXT: ) |
| 3516 | + ;; OPTIN-NEXT: ) |
| 3517 | + ;; OPTIN-NEXT: ) |
| 3518 | + (func $set-silly (param $x i32) |
| 3519 | + ;; Setting x to x adds no information, and we do not store it in the IR. This |
| 3520 | + ;; must not lead to internal errors (we have asserts on not storing |
| 3521 | + ;; "proves-nothing" in the internal map, and if we wrote this, it would be |
| 3522 | + ;; that). |
| 3523 | + (local.set $x |
| 3524 | + (local.get $x) |
| 3525 | + ) |
| 3526 | + ;; Add some control flow to exercise the assert. |
| 3527 | + (if |
| 3528 | + (i32.const 0) |
| 3529 | + (then) |
| 3530 | + ) |
| 3531 | + ) |
3475 | 3532 | ) |
| 3533 | + |
0 commit comments