Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

return_call with call.without.effects optimizes incorrectly #8693

Copy link
Copy link

Description

@stevenfontanella
Issue body actions

In the following module, $f always returns 1.

(module
  (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (param funcref) (result i32)))
  (func $g (result i32)
    (i32.const 1)
  )
  (func $f (result i32)
    (return_call $call-without-effects (ref.func $g))
    (unreachable)
  )
)

But when optimized with bin/wasm-opt -all --vacuum a.wat -S -o - (from the current main), we end up with the following module which returns 0:

(module
 (type $0 (func (result i32)))
 (type $1 (func (param funcref) (result i32)))
 (import "binaryen-intrinsics" "call.without.effects" (func $call-without-effects (type $1) (param funcref) (result i32)))
 (func $g (type $0) (result i32)
  (i32.const 1)
 )
 (func $f (type $0) (result i32)
  (i32.const 0)
 )
)

The problem is that call.without.effects doesn't set a branchesOut effect. Although call.without.effects assumes that the call body has no effects, the return_call does have the effect of branching out which isn't reflected correctly here.

Reactions are currently unavailable

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.