- 
                Notifications
    
You must be signed in to change notification settings  - Fork 818
 
Open
Description
Test Case
;; test.wat
(module
  (import "" "get-a" (func $get-a (result i32)))
  (import "" "get-b" (func $get-b (result i64)))
  (import "" "get-both" (func $get-both (result i32 i64)))
  (import "" "take" (func $take (param i32 i64)))
  (func (export "f")
    (local i32 i64)
    call $get-both
    local.set 1
    local.tee 0
    local.get 1
    call $take
  )
  (func (export "g")
    (local i32 i64)
    call $get-a
    call $get-b
    local.set 1
    local.tee 0
    local.get 1
    call $take
  )
)Steps to Reproduce
$ wasm-tools parse test.wat -o test.wasm # or wasm2wat or whatever...
$ wasm-opt -O4 --enable-multivalue test.wasm -o test.opt.wasm
$ wasm-tools print ~/scratch/missing-opt.opt.wasm 
Expected Results
Neither f nor g should have any locals or local.{get,tee} instructions after optimizations.
Actual Results
The locals are successfully removed from g, which does not use multi-value; however, they are not removed from f, which is equivalent to g except that it uses multi-value:
(module
  (type (;0;) (func))
  (type (;1;) (func (result i32)))
  (type (;2;) (func (result i64)))
  (type (;3;) (func (result i32 i64)))
  (type (;4;) (func (param i32 i64)))
  (import "" "get-a" (func (;0;) (type 1)))
  (import "" "get-b" (func (;1;) (type 2)))
  (import "" "get-both" (func (;2;) (type 3)))
  (import "" "take" (func (;3;) (type 4)))
  (export "f" (func 4))
  (export "g" (func 5))
  (func (;4;) (type 0)
    (local i32 i64)
    call 2
    local.set 1
    local.tee 0
    local.get 1
    call 3
  )
  (func (;5;) (type 0)
    call 0
    call 1
    call 3
  )
)Additional Information
This wasm-opt was built from commit d0156b4.
cc @tlively
Metadata
Metadata
Assignees
Labels
No labels