diff options
author | Thomas Lively <tlively@google.com> | 2024-04-16 01:08:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 01:08:13 -0700 |
commit | e4608772910d4d879b0a4783bacba3b4890b828c (patch) | |
tree | 932ebc6aeb457df8c8ade4a0f715404242968478 /test/lit/passes | |
parent | 75993de411117e79c57a09d1276bd1b2773c94df (diff) | |
download | binaryen-e4608772910d4d879b0a4783bacba3b4890b828c.tar.gz binaryen-e4608772910d4d879b0a4783bacba3b4890b828c.tar.bz2 binaryen-e4608772910d4d879b0a4783bacba3b4890b828c.zip |
Do not repeat types names in text output (#6499)
For types that do not have explicit names, we generate index-based names in the
printer. However, we did not previously ensure that the generated types were not
already used as explicit names, so it was possible to print the same name for
multiple types, which is not valid.
Fix the problem by skipping indices that are already used as type names.
Fixes #6492.
Diffstat (limited to 'test/lit/passes')
-rw-r--r-- | test/lit/passes/O4_disable-bulk-memory.wast | 2 | ||||
-rw-r--r-- | test/lit/passes/coalesce-locals.wast | 8 | ||||
-rw-r--r-- | test/lit/passes/dae-optimizing.wast | 6 | ||||
-rw-r--r-- | test/lit/passes/flatten_all-features.wast | 14 | ||||
-rw-r--r-- | test/lit/passes/fpcast-emu.wast | 4 | ||||
-rw-r--r-- | test/lit/passes/instrument-memory.wast | 10 | ||||
-rw-r--r-- | test/lit/passes/instrument-memory64.wast | 10 | ||||
-rw-r--r-- | test/lit/passes/optimize-instructions-mvp.wast | 4 |
8 files changed, 29 insertions, 29 deletions
diff --git a/test/lit/passes/O4_disable-bulk-memory.wast b/test/lit/passes/O4_disable-bulk-memory.wast index 63bb0ea40..0cafb1d5d 100644 --- a/test/lit/passes/O4_disable-bulk-memory.wast +++ b/test/lit/passes/O4_disable-bulk-memory.wast @@ -50,7 +50,7 @@ (type $7 (func (param i32 i32 i32))) ;; CHECK: (type $11 (func (param i32))) - ;; CHECK: (type $3 (func (param f64 f64 f64 f64 f64 f64 f64) (result i32))) + ;; CHECK: (type $12 (func (param f64 f64 f64 f64 f64 f64 f64) (result i32))) ;; CHECK: (type $8 (func (result f64))) (type $8 (func (result f64))) diff --git a/test/lit/passes/coalesce-locals.wast b/test/lit/passes/coalesce-locals.wast index f195c3681..5441c3fd6 100644 --- a/test/lit/passes/coalesce-locals.wast +++ b/test/lit/passes/coalesce-locals.wast @@ -12,7 +12,7 @@ ;; CHECK: (type $FUNCSIG$iii (func (param i32 i32) (result i32))) - ;; CHECK: (type $4 (func (param f64 i32) (result i64))) + ;; CHECK: (type $5 (func (param f64 i32) (result i64))) ;; CHECK: (type $3 (func (param i32 f32))) @@ -22,11 +22,11 @@ (type $2 (func)) (type $3 (func (param i32 f32))) (type $4 (func (param i32))) - ;; CHECK: (type $7 (func (param i32) (result i32))) + ;; CHECK: (type $8 (func (param i32) (result i32))) - ;; CHECK: (type $8 (func (param i32 i32))) + ;; CHECK: (type $9 (func (param i32 i32))) - ;; CHECK: (type $9 (func (result f64))) + ;; CHECK: (type $10 (func (result f64))) ;; CHECK: (import "env" "_emscripten_autodebug_i32" (func $_emscripten_autodebug_i32 (param i32 i32) (result i32))) (import "env" "_emscripten_autodebug_i32" (func $_emscripten_autodebug_i32 (param i32 i32) (result i32))) diff --git a/test/lit/passes/dae-optimizing.wast b/test/lit/passes/dae-optimizing.wast index cb15d55cb..b9b7e7e2e 100644 --- a/test/lit/passes/dae-optimizing.wast +++ b/test/lit/passes/dae-optimizing.wast @@ -4,10 +4,12 @@ ;; RUN: foreach %s %t wasm-opt --dae-optimizing -S -o - | filecheck %s (module - ;; CHECK: (type $0 (func (result i32))) (type $0 (func (param f32) (result f32))) - ;; CHECK: (type $1 (func (result f32))) (type $1 (func (param f64 f32 f32 f64 f32 i64 f64) (result i32))) + ;; CHECK: (type $3 (func (result i32))) + + ;; CHECK: (type $4 (func (result f32))) + ;; CHECK: (type $2 (func (param f64 f32 f32 f64 f32 i32 i32 f64) (result i32))) (type $2 (func (param f64 f32 f32 f64 f32 i32 i32 f64) (result i32))) ;; CHECK: (global $global$0 (mut i32) (i32.const 10)) diff --git a/test/lit/passes/flatten_all-features.wast b/test/lit/passes/flatten_all-features.wast index aa3dc7578..2ba7c6954 100644 --- a/test/lit/passes/flatten_all-features.wast +++ b/test/lit/passes/flatten_all-features.wast @@ -14,11 +14,11 @@ (type $2 (func (result i32))) ;; CHECK: (type $3 (func (param i32) (result i32))) (type $3 (func (param i32) (result i32))) - ;; CHECK: (type $4 (func (result f32))) - (type $4 (func (param i64 i64) (result i64))) - ;; CHECK: (type $4 (func (param i64 i64) (result i64))) + ;; CHECK: (type $5 (func (result f32))) - ;; CHECK: (type $6 (func (result anyref))) + ;; CHECK: (type $4 (func (param i64 i64) (result i64))) + (type $4 (func (param i64 i64) (result i64))) + ;; CHECK: (type $7 (func (result anyref))) ;; CHECK: (global $x (mut i32) (i32.const 0)) (global $x (mut i32) (i32.const 0)) @@ -833,7 +833,7 @@ (i32.const 0) ) ) - ;; CHECK: (func $a17 (type $4) (result f32) + ;; CHECK: (func $a17 (type $5) (result f32) ;; CHECK-NEXT: (local $var$0 f32) ;; CHECK-NEXT: (local $1 f32) ;; CHECK-NEXT: (local $2 f32) @@ -921,7 +921,7 @@ ) ) ) - ;; CHECK: (func $a19 (type $4) (result f32) + ;; CHECK: (func $a19 (type $5) (result f32) ;; CHECK-NEXT: (block $label$0 ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (unreachable) @@ -3585,7 +3585,7 @@ ;; targets an outer branch whose return type is a supertype of the br_if's ;; value type, we need the value to be set into two locals: one with the outer ;; block's type, and one with its value type. - ;; CHECK: (func $subtype (type $6) (result anyref) + ;; CHECK: (func $subtype (type $7) (result anyref) ;; CHECK-NEXT: (local $0 eqref) ;; CHECK-NEXT: (local $1 anyref) ;; CHECK-NEXT: (local $2 nullref) diff --git a/test/lit/passes/fpcast-emu.wast b/test/lit/passes/fpcast-emu.wast index 167e57d26..8ded82647 100644 --- a/test/lit/passes/fpcast-emu.wast +++ b/test/lit/passes/fpcast-emu.wast @@ -297,7 +297,7 @@ (type $0 (func (param i64))) ;; CHECK: (type $1 (func (param f32) (result i64))) (type $1 (func (param f32) (result i64))) - ;; CHECK: (type $1 (func (param i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64) (result i64))) + ;; CHECK: (type $2 (func (param i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64 i64) (result i64))) ;; CHECK: (global $global$0 (mut i32) (i32.const 10)) (global $global$0 (mut i32) (i32.const 10)) @@ -312,7 +312,7 @@ ;; CHECK-NEXT: (global.set $global$0 ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (call_indirect (type $1) + ;; CHECK-NEXT: (call_indirect (type $2) ;; CHECK-NEXT: (br $label$1 ;; CHECK-NEXT: (i64.const 4294967295) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/instrument-memory.wast b/test/lit/passes/instrument-memory.wast index 74b1e75d4..f776d2af1 100644 --- a/test/lit/passes/instrument-memory.wast +++ b/test/lit/passes/instrument-memory.wast @@ -7,15 +7,15 @@ (memory 256 256) ;; CHECK: (type $1 (func)) (type $1 (func)) - ;; CHECK: (type $1 (func (param i32 i32 i32 i32) (result i32))) + ;; CHECK: (type $2 (func (param i32 i32 i32 i32) (result i32))) - ;; CHECK: (type $2 (func (param i32 i32) (result i32))) + ;; CHECK: (type $3 (func (param i32 i32) (result i32))) - ;; CHECK: (type $3 (func (param i32 i64) (result i64))) + ;; CHECK: (type $4 (func (param i32 i64) (result i64))) - ;; CHECK: (type $4 (func (param i32 f32) (result f32))) + ;; CHECK: (type $5 (func (param i32 f32) (result f32))) - ;; CHECK: (type $5 (func (param i32 f64) (result f64))) + ;; CHECK: (type $6 (func (param i32 f64) (result f64))) ;; CHECK: (import "env" "load_ptr" (func $load_ptr (param i32 i32 i32 i32) (result i32))) diff --git a/test/lit/passes/instrument-memory64.wast b/test/lit/passes/instrument-memory64.wast index 1f3be75d5..5ceb37fe2 100644 --- a/test/lit/passes/instrument-memory64.wast +++ b/test/lit/passes/instrument-memory64.wast @@ -7,15 +7,15 @@ (memory i64 256 256) ;; CHECK: (type $1 (func)) (type $1 (func)) - ;; CHECK: (type $1 (func (param i32 i32 i64 i64) (result i64))) + ;; CHECK: (type $2 (func (param i32 i32 i64 i64) (result i64))) - ;; CHECK: (type $2 (func (param i32 i32) (result i32))) + ;; CHECK: (type $3 (func (param i32 i32) (result i32))) - ;; CHECK: (type $3 (func (param i32 i64) (result i64))) + ;; CHECK: (type $4 (func (param i32 i64) (result i64))) - ;; CHECK: (type $4 (func (param i32 f32) (result f32))) + ;; CHECK: (type $5 (func (param i32 f32) (result f32))) - ;; CHECK: (type $5 (func (param i32 f64) (result f64))) + ;; CHECK: (type $6 (func (param i32 f64) (result f64))) ;; CHECK: (import "env" "load_ptr" (func $load_ptr (param i32 i32 i64 i64) (result i64))) diff --git a/test/lit/passes/optimize-instructions-mvp.wast b/test/lit/passes/optimize-instructions-mvp.wast index b618cf200..43da637e8 100644 --- a/test/lit/passes/optimize-instructions-mvp.wast +++ b/test/lit/passes/optimize-instructions-mvp.wast @@ -2,10 +2,8 @@ ;; RUN: wasm-opt %s --optimize-instructions --mvp-features -S -o - | filecheck %s (module - ;; CHECK: (type $0 (func (result i32))) - (type $0 (func (param i32 i64))) - ;; CHECK: (type $0 (func (param i32 i64))) + (type $0 (func (param i32 i64))) ;; CHECK: (import "a" "b" (func $get-f64 (result f64))) (import "a" "b" (func $get-f64 (result f64))) |