Skip to content

Propagate constants when inlining #209

Open
@MaxGraey

Description

@MaxGraey
@inline
function foo(x: i32): i32 {
  if (isConstant(x)) {
    return -1;
  } else {
    return x;
  }
}

export function test(): i32 {
  return foo(10);
}

produce:

(func $main/test (export "test") (type $t0) (result i32)
  i32.const 10
)

expected:

(func $main/test (export "test") (type $t0) (result i32)
  i32.const -1
)

example in playground

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions