Skip to content

Commit

Permalink
[NFC] Avoid v128 in rec groups with no other v128 uses (#6843)
Browse files Browse the repository at this point in the history
We don't properly validate that yet. E.g.:

(module
 (rec
  (type $func (func))
  (type $unused (sub (struct (field v128))))
 )
 (func $func (type $func))
)

That v128 is not used, but it ends up in the output because it is in a rec group that is used.
Atm we do not require that SIMD be enabled in such a case, which can trip up the fuzzer.

Context: #6820. For now, modify the test that uncovered this.
  • Loading branch information
kripken authored Aug 15, 2024
1 parent 033a16e commit c2b4380
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test/lit/passes/gto-removals.wast
Original file line number Diff line number Diff line change
Expand Up @@ -1032,14 +1032,14 @@
(module
(rec
;; CHECK: (rec
;; CHECK-NEXT: (type $A (sub (struct (field i64) (field v128) (field nullref))))
(type $A (sub (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field v128) (field nullref))))
;; CHECK-NEXT: (type $A (sub (struct (field i64) (field eqref) (field nullref))))
(type $A (sub (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field eqref) (field nullref))))

;; CHECK: (type $C (sub $A (struct (field i64) (field v128) (field nullref) (field f64) (field anyref))))
(type $C (sub $A (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field v128) (field nullref))))
;; CHECK: (type $C (sub $A (struct (field i64) (field eqref) (field nullref) (field f64) (field anyref))))
(type $C (sub $A (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field eqref) (field nullref))))

;; CHECK: (type $B (sub $A (struct (field i64) (field v128) (field nullref) (field f32) (field anyref))))
(type $B (sub $A (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field v128) (field nullref))))
;; CHECK: (type $B (sub $A (struct (field i64) (field eqref) (field nullref) (field f32) (field anyref))))
(type $B (sub $A (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field eqref) (field nullref))))
)

;; CHECK: (type $3 (func (param anyref)))
Expand Down Expand Up @@ -1115,10 +1115,10 @@
;; Field 2 (f32) is used only in $B.
;; Field 3 (f64) is used only in $C.
;; Field 4 (anyref) is used only in $B and $C.
;; Field 5 (v128) is used only in $A and $C.
;; Field 5 (eqref) is used only in $A and $C.
;; Field 6 (nullref) is used only in $A and $B.
;; As a result:
;; * A can keep only fields 1, 5, 6 (i64, v128, nullref).
;; * A can keep only fields 1, 5, 6 (i64, eqref, nullref).
;; * B keeps A's fields, and appends 2, 4 (f32, anyref).
;; * C keeps A's fields, and appends 3, 4 (f64, anyref).

Expand All @@ -1145,14 +1145,14 @@
(module
(rec
;; CHECK: (rec
;; CHECK-NEXT: (type $A (sub (struct (field i64) (field v128) (field nullref))))
(type $A (sub (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field v128) (field nullref))))
;; CHECK-NEXT: (type $A (sub (struct (field i64) (field eqref) (field nullref))))
(type $A (sub (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field eqref) (field nullref))))

;; CHECK: (type $B (sub $A (struct (field i64) (field v128) (field nullref) (field f32) (field anyref))))
(type $B (sub $A (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field v128) (field nullref))))
;; CHECK: (type $B (sub $A (struct (field i64) (field eqref) (field nullref) (field f32) (field anyref))))
(type $B (sub $A (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field eqref) (field nullref))))

;; CHECK: (type $C (sub $B (struct (field i64) (field v128) (field nullref) (field f32) (field anyref) (field f64))))
(type $C (sub $B (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field v128) (field nullref))))
;; CHECK: (type $C (sub $B (struct (field i64) (field eqref) (field nullref) (field f32) (field anyref) (field f64))))
(type $C (sub $B (struct (field i32) (field i64) (field f32) (field f64) (field anyref) (field eqref) (field nullref))))
)

;; CHECK: (type $3 (func (param anyref)))
Expand Down

0 comments on commit c2b4380

Please sign in to comment.