diff options
author | Thomas Lively <tlively@google.com> | 2023-09-18 21:54:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-18 21:54:14 -0700 |
commit | a51bd6df919a5b79574f0996a760cc20cb05697e (patch) | |
tree | 32f67c9568aaee16b67ce0a4e6df1df2fb487036 /test/lit/multivalue.wast | |
parent | 6bab227860a6873204141e5ec9b14ed08d77fc62 (diff) | |
download | binaryen-a51bd6df919a5b79574f0996a760cc20cb05697e.tar.gz binaryen-a51bd6df919a5b79574f0996a760cc20cb05697e.tar.bz2 binaryen-a51bd6df919a5b79574f0996a760cc20cb05697e.zip |
Reland "Optimize tuple.extract of gets in BinaryInstWriter" (#5955)
In general, the binary lowering of tuple.extract expects that all the tuple
values are on top of the stack, so it inserts drops and possibly uses a scratch
local to ensure only the extracted value is left. However, when the extracted
tuple expression is a local.get, local.tee, or global.get, it's much more
efficient to change the lowering of the get or tee to ensure that only the
extracted value is on the stack to begin with. Implement that optimization in
the binary writer.
Diffstat (limited to 'test/lit/multivalue.wast')
-rw-r--r-- | test/lit/multivalue.wast | 86 |
1 files changed, 4 insertions, 82 deletions
diff --git a/test/lit/multivalue.wast b/test/lit/multivalue.wast index f75182ca4..0d52f5382 100644 --- a/test/lit/multivalue.wast +++ b/test/lit/multivalue.wast @@ -155,13 +155,6 @@ ;; CHECK-NEXT: (local $5 (i32 i64 f32)) ;; CHECK-NEXT: (local $6 i64) ;; CHECK-NEXT: (local $7 i32) - ;; CHECK-NEXT: (local $8 i64) - ;; CHECK-NEXT: (local $9 i32) - ;; CHECK-NEXT: (local $10 i64) - ;; CHECK-NEXT: (local $11 i32) - ;; CHECK-NEXT: (local $12 i64) - ;; CHECK-NEXT: (local $13 i32) - ;; CHECK-NEXT: (local $14 f32) ;; CHECK-NEXT: (local.set $5 ;; CHECK-NEXT: (call $triple) ;; CHECK-NEXT: ) @@ -190,69 +183,10 @@ ;; CHECK-NEXT: (local.get $7) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $9 - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result i64) - ;; CHECK-NEXT: (local.set $8 - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $4 - ;; CHECK-NEXT: (local.get $3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $8) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $9) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) ;; CHECK-NEXT: (tuple.make - ;; CHECK-NEXT: (block (result f32) - ;; CHECK-NEXT: (local.set $14 - ;; CHECK-NEXT: (local.get $4) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $11 - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (block (result i64) - ;; CHECK-NEXT: (local.set $10 - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (local.get $3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $10) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $11) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $14) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $2) - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $13 - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result i64) - ;; CHECK-NEXT: (local.set $12 - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (local.get $3) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $12) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $13) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $reverse (result f32 i64 i32) @@ -296,7 +230,6 @@ ;; CHECK: (func $global (type $0) (result i32 i64) ;; CHECK-NEXT: (local $0 i64) ;; CHECK-NEXT: (local $1 i32) - ;; CHECK-NEXT: (local $2 i32) ;; CHECK-NEXT: (global.set $g1 ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (local.set $1 @@ -309,18 +242,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $2 - ;; CHECK-NEXT: (global.get $g1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (global.get $g2) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get $2) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (global.get $g2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (tuple.make ;; CHECK-NEXT: (global.get $global$2) |