Skip to content

Propagate constant load/store offsets more efficiently #32

Closed
@MaxGraey

Description

@MaxGraey

For example:

const index = 4;
store<i32>(ptr + <usize>index * sizeof<i32>(), value);
// emit as: (i32.store (i32.add (get_local $0) (i32.const 16)) (get_local $2))

Good optimize to this in compile time:

store<i32>(ptr, value, 4 * sizeof<i32>());
// emit as: (i32.store offset=16 (get_local $0) (get_local $2))

So may be this good doing inside load / store buildins.

That do you think?

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