Skip to content

Optimize load-extend sequence #2120

Open
@lexaknyazev

Description

@lexaknyazev

These two functions are semantically the same but the first uses one more instruction:

export function foo(): u64 {
  const a = load<u8>(16);
  return <u64>a;
}

export function bar(): u64 {
  return <u64>load<u8>(16);
}
 (func $module/foo (result i64)
  i32.const 16
  i32.load8_u
  i64.extend_i32_u
 )
 (func $module/bar (result i64)
  i32.const 16
  i64.load8_u
 )

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