diff options
author | Alon Zakai <azakai@google.com> | 2021-10-11 17:37:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-11 17:37:23 -0700 |
commit | ecda340b791be6c0a31c7dd290a682244aff3e89 (patch) | |
tree | 93d97df579919bb6fef6e796d949ebd9f763cc6f /test | |
parent | 072c60c9314ca37f0f4a9393bb81dabd1be5a6b5 (diff) | |
download | binaryen-ecda340b791be6c0a31c7dd290a682244aff3e89.tar.gz binaryen-ecda340b791be6c0a31c7dd290a682244aff3e89.tar.bz2 binaryen-ecda340b791be6c0a31c7dd290a682244aff3e89.zip |
Fix tee/as-non-null reordering when writing to a non-nullable param (#4232)
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/optimize-instructions-gc.wast | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast index 37db14f9e..ab973ffae 100644 --- a/test/lit/passes/optimize-instructions-gc.wast +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -1254,6 +1254,37 @@ ) ) ) + + ;; CHECK: (func $flip-tee-of-as-non-null-non-nullable (param $x (ref any)) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (local.tee $x + ;; CHECK-NEXT: (ref.as_non_null + ;; CHECK-NEXT: (ref.null any) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; NOMNL: (func $flip-tee-of-as-non-null-non-nullable (param $x (ref any)) + ;; NOMNL-NEXT: (drop + ;; NOMNL-NEXT: (local.tee $x + ;; NOMNL-NEXT: (ref.as_non_null + ;; NOMNL-NEXT: (ref.null any) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) + (func $flip-tee-of-as-non-null-non-nullable (param $x (ref any)) + (drop + (local.tee $x + ;; this *cannnot* be moved through the tee outward, as the param is in + ;; fact non-nullable, and we depend on the ref.as_non_null in order to + ;; get a valid type to assign to it + (ref.as_non_null + (ref.null any) + ) + ) + ) + ) ;; CHECK: (func $ternary-identical-arms (param $x i32) (param $y (ref null $struct)) (param $z (ref null $struct)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.is_null |