|
608 | 608 | ) |
609 | 609 |
|
610 | 610 | ;; TNH: (func $null.cast-other.effects (type $ref?|$struct|_=>_none) (param $x (ref null $struct)) |
| 611 | + ;; TNH-NEXT: (local $i i32) |
611 | 612 | ;; TNH-NEXT: (struct.set $struct 0 |
612 | 613 | ;; TNH-NEXT: (local.get $x) |
613 | 614 | ;; TNH-NEXT: (call $import) |
|
616 | 617 | ;; TNH-NEXT: (local.get $x) |
617 | 618 | ;; TNH-NEXT: (i32.const 10) |
618 | 619 | ;; TNH-NEXT: ) |
| 620 | + ;; TNH-NEXT: (struct.set $struct 0 |
| 621 | + ;; TNH-NEXT: (local.get $x) |
| 622 | + ;; TNH-NEXT: (local.tee $i |
| 623 | + ;; TNH-NEXT: (i32.const 10) |
| 624 | + ;; TNH-NEXT: ) |
| 625 | + ;; TNH-NEXT: ) |
619 | 626 | ;; TNH-NEXT: ) |
620 | 627 | ;; NO_TNH: (func $null.cast-other.effects (type $ref?|$struct|_=>_none) (param $x (ref null $struct)) |
| 628 | + ;; NO_TNH-NEXT: (local $i i32) |
621 | 629 | ;; NO_TNH-NEXT: (struct.set $struct 0 |
622 | 630 | ;; NO_TNH-NEXT: (ref.as_non_null |
623 | 631 | ;; NO_TNH-NEXT: (local.get $x) |
|
628 | 636 | ;; NO_TNH-NEXT: (local.get $x) |
629 | 637 | ;; NO_TNH-NEXT: (i32.const 10) |
630 | 638 | ;; NO_TNH-NEXT: ) |
| 639 | + ;; NO_TNH-NEXT: (struct.set $struct 0 |
| 640 | + ;; NO_TNH-NEXT: (local.get $x) |
| 641 | + ;; NO_TNH-NEXT: (local.tee $i |
| 642 | + ;; NO_TNH-NEXT: (i32.const 10) |
| 643 | + ;; NO_TNH-NEXT: ) |
| 644 | + ;; NO_TNH-NEXT: ) |
631 | 645 | ;; NO_TNH-NEXT: ) |
632 | 646 | (func $null.cast-other.effects (param $x (ref null $struct)) |
| 647 | + (local $i i32) |
633 | 648 | (struct.set $struct 0 |
634 | 649 | ;; We cannot remove this ref.as_non_null, even though the struct.set will |
635 | 650 | ;; trap if the ref is null, because that would move the trap from before |
|
648 | 663 | ) |
649 | 664 | (i32.const 10) |
650 | 665 | ) |
| 666 | + (struct.set $struct 0 |
| 667 | + ;; This one can be removed even without TNH, even though there are effects |
| 668 | + ;; in it. A tee only has local effects, which do not interfere with a |
| 669 | + ;; trap. |
| 670 | + (ref.as_non_null |
| 671 | + (local.get $x) |
| 672 | + ) |
| 673 | + (local.tee $i |
| 674 | + (i32.const 10) |
| 675 | + ) |
| 676 | + ) |
651 | 677 | ) |
652 | 678 |
|
653 | 679 | ;; Helper functions. |
|
0 commit comments