File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -2423,7 +2423,7 @@ struct OptimizeInstructions
2423
2423
//
2424
2424
if (auto * as = curr->ref ->dynCast <RefAs>(); as && as->op == RefAsNonNull) {
2425
2425
curr->ref = as->value ;
2426
- curr->type = Type ( curr->type .getHeapType (), NonNullable);
2426
+ curr->type = curr->type .with ( NonNullable);
2427
2427
}
2428
2428
}
2429
2429
Original file line number Diff line number Diff line change 1
1
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
2
2
3
- ;; RUN: wasm-opt %s -all --disable-custom-descriptors -- optimize-instructions -S -o - | filecheck %s
3
+ ;; RUN: wasm-opt %s -all --optimize-instructions -S -o - | filecheck %s
4
4
5
5
(module
6
6
;; CHECK: (type $foo (sub (struct)))
63
63
)
64
64
)
65
65
)
66
+
67
+ ;; CHECK: (func $combine-non-null (type $3) (param $foo (ref null $foo)) (result (ref (exact $foo)))
68
+ ;; CHECK-NEXT: (ref.cast (ref (exact $foo))
69
+ ;; CHECK-NEXT: (local.get $foo)
70
+ ;; CHECK-NEXT: )
71
+ ;; CHECK-NEXT: )
72
+ (func $combine-non-null (param $foo (ref null $foo )) (result (ref (exact $foo )))
73
+ ;; We should not lose the exactness of the cast when we combine the
74
+ ;; ref.as_non_null into it.
75
+ (ref.cast (ref null (exact $foo ))
76
+ (ref.as_non_null
77
+ (local.get $foo )
78
+ )
79
+ )
80
+ )
66
81
)
You can’t perform that action at this time.
0 commit comments