Skip to content

Support dynamic early return in QIR generation via inserted mutable variable updates #2387

Open
@swernli

Description

@swernli

This is follow on from #2290. To fully support early returns from dynamic contexts, we need partial evaluation to do additional book keeping on each callable invocation (including the entry point). Specifically, when an explicit return is hit, a store into a special return variable should be inserted into the RIR. Then if there is an implicit return from the callable when any such early return was previously triggered the implicit return should be treated the same as an explicit return by inserting the same kind of store instructions. This special return variable would need to be created and managed for every call scope, with potential for optimizing it out in cases where it isn't used (such as explicitly returning from a Unit-typed callable).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions