Skip to content

[Feature]: Improve UntuplePass #1832

Description

@nicolaassolini-qntm

Problem Statement

When compiling programs as

from guppylang import guppy
from guppylang.std.collections import Stack
from guppylang.std.builtins import array

@guppy.struct
class MyStruct:
    qb: array[int, 1]
    stack: Stack[int, 1]

@guppy.declare
def state_gen() -> MyStruct: ...

@guppy.declare
def state_discard(s: MyStruct @ owned) -> None: ...

@guppy
def wrapper() -> None:
    state = state_gen()
    state_discard(state)

we do not fully simplify the hugr.
UntuplePass only removes MakeTuple -> UnpackTuple sequence. Also, the pass is not iterative, so MakeTuple -> MakeTuple -> Unpack -> Unpack only removes the internal pair.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions