Skip to content

Add a get_and_zero_local operator. #698

@ghost

Description

The use case is to help inform the runtime compiler that local variables are not used (or constants) over code ranges.

This might be exploited by a baseline compiler to avoid flushing local variables cached in registers to memory. If a use of a local variable also zeros it then whatever value it had is no longer needed.

For decoding to SSA, if wasm code can use get_and_zero_local on the last use of a local then at control flow merge points the locals not live will be flagged as constant zero rather than having potentially different definitions, and this would avoid the need to emit a phi for them rather a single definition could be carried forward flagged as zero.

My expressionless encoding experiment noted excess phi's being generated for unused locals as a problem, but perhaps being able to zero a local on the last use of a definition offers a way to address this. Something to explore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions