summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/dae_tnh.wast34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/lit/passes/dae_tnh.wast b/test/lit/passes/dae_tnh.wast
new file mode 100644
index 000000000..fc9270cf3
--- /dev/null
+++ b/test/lit/passes/dae_tnh.wast
@@ -0,0 +1,34 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: foreach %s %t wasm-opt --dae --all-features -tnh -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (type $none_=>_none (func))
+
+ ;; CHECK: (type $ref?|$struct|_=>_none (func (param (ref null $struct))))
+
+ ;; CHECK: (type $struct (struct (field i32)))
+ (type $struct (struct_subtype (field i32) data))
+
+ ;; CHECK: (func $target
+ ;; CHECK-NEXT: (local $0 i32)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
+ (func $target (param $x i32)
+ (nop)
+ )
+
+ ;; CHECK: (func $caller (param $ref (ref null $struct))
+ ;; CHECK-NEXT: (call $target)
+ ;; CHECK-NEXT: )
+ (func $caller (param $ref (ref null $struct))
+ (call $target
+ ;; This might trap in theory, but in traps-never-happen mode which is
+ ;; enabled here, we can ignore and remove such side effects, allowing us
+ ;; to optimize away this parameter which is never used.
+ (struct.get $struct 0
+ (local.get $ref)
+ )
+ )
+ )
+)