diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/ssa.wast | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/lit/passes/ssa.wast b/test/lit/passes/ssa.wast new file mode 100644 index 000000000..6be5ee11a --- /dev/null +++ b/test/lit/passes/ssa.wast @@ -0,0 +1,34 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s -all --ssa -S -o - | filecheck %s + +(module + (func $foo) + ;; CHECK: (func $bar (param $x (ref func)) + ;; CHECK-NEXT: (local $1 funcref) + ;; CHECK-NEXT: (local $2 funcref) + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (ref.func $foo) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (ref.as_non_null + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $2 + ;; CHECK-NEXT: (ref.func $bar) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (ref.as_non_null + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $bar (param $x (ref func)) + ;; assign a non-nullable parameter multiple times, which causes ssa to create + ;; new locals so that each is assigned only once + (local.set $x (ref.func $foo)) + (drop (local.get $x)) + (local.set $x (ref.func $bar)) + (drop (local.get $x)) + ) +) |