summaryrefslogtreecommitdiff
path: root/test/lit/passes/optimize-instructions-gc-heap.wast
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-10-19 12:52:59 -0700
committerGitHub <noreply@github.com>2021-10-19 12:52:59 -0700
commitd09be7af5b00f5e739ed56077ac5fb6b8e4e2adf (patch)
treec8c66b78b2334928cdc1e0767ae35831440d2e89 /test/lit/passes/optimize-instructions-gc-heap.wast
parentc19ff59c71824b34fa312aac9ad979e2198d7d36 (diff)
downloadbinaryen-d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf.tar.gz
binaryen-d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf.tar.bz2
binaryen-d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf.zip
OptimizeInstructions: Ignore unreachable subsequent sets (#4259)
Fuzzing followup to #4244.
Diffstat (limited to 'test/lit/passes/optimize-instructions-gc-heap.wast')
-rw-r--r--test/lit/passes/optimize-instructions-gc-heap.wast47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-instructions-gc-heap.wast b/test/lit/passes/optimize-instructions-gc-heap.wast
index 4554e651d..e14f101c6 100644
--- a/test/lit/passes/optimize-instructions-gc-heap.wast
+++ b/test/lit/passes/optimize-instructions-gc-heap.wast
@@ -710,6 +710,53 @@
)
)
+ ;; CHECK: (func $unreachable
+ ;; CHECK-NEXT: (local $ref (ref null $struct))
+ ;; CHECK-NEXT: (local.tee $ref
+ ;; CHECK-NEXT: (block
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.set $struct 0
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: (i32.const 10)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (local.set $ref
+ ;; CHECK-NEXT: (struct.new $struct
+ ;; CHECK-NEXT: (i32.const 20)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.set $struct 0
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $unreachable
+ (local $ref (ref null $struct))
+ ;; Do not optimize unreachable code, either in the new (first pair) or the
+ ;; set (second pair)
+ (local.set $ref
+ (struct.new $struct
+ (unreachable)
+ )
+ )
+ (struct.set $struct 0
+ (local.get $ref)
+ (i32.const 10)
+ )
+ (nop)
+ (local.set $ref
+ (struct.new $struct
+ (i32.const 20)
+ )
+ )
+ (struct.set $struct 0
+ (local.get $ref)
+ (unreachable)
+ )
+ )
+
;; CHECK: (func $helper-i32 (param $x i32) (result i32)
;; CHECK-NEXT: (i32.const 42)
;; CHECK-NEXT: )