Skip to content

flow-control: Support lowering of Deconstruct node. #8116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: pr/liorgold2/lior/flow-control/edbf06d2
Choose a base branch
from

Conversation

liorgold2
Copy link
Collaborator

@liorgold2 liorgold2 commented Aug 5, 2025

Stack:

⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@reviewable-StarkWare
Copy link

This change is Reviewable

@ilyalesokhin-starkware
Copy link
Contributor

crates/cairo-lang-lowering/src/lower/flow_control/lower_graph/lower_node.rs line 209 at r1 (raw file):

                location: ctx.ctx.variables[var_id].location,
            },
        );

this is weird, why does register_var takes a VarUsage and not a VarId?

Code quote:

        ctx.register_var(
            *output,
            VarUsage {
                var_id,
                // The variable is used immediately after the destructure, so the usage
                // location is the same as the definition location.
                location: ctx.ctx.variables[var_id].location,
            },
        );

Copy link
Contributor

@ilyalesokhin-starkware ilyalesokhin-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 4 files at r1.
Reviewable status: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @liorgold2)

@ilyalesokhin-starkware
Copy link
Contributor

crates/cairo-lang-lowering/src/lower/flow_control/lower_graph/lower_node.rs line 193 at r1 (raw file):

        .outputs
        .iter()
        .map(|output| VarRequest { ty: output.ty(ctx.graph), location: output.location(ctx.graph) })

Can you improve the documentation of this function?
and
FlowControlGraph.var_locations?

Code quote:

 output.location(ctx.graph)

@ilyalesokhin-starkware
Copy link
Contributor

crates/cairo-lang-lowering/src/lower/flow_control/lower_graph/lower_node.rs line 193 at r1 (raw file):

Previously, ilyalesokhin-starkware wrote…

Can you improve the documentation of this function?
and
FlowControlGraph.var_locations?

It seems to be the location that triggered the creation of the variable.

@liorgold2 liorgold2 force-pushed the pr/liorgold2/lior/flow-control/acb4afda branch from dd7aa8c to 25468e4 Compare August 7, 2025 20:03
@liorgold2 liorgold2 force-pushed the pr/liorgold2/lior/flow-control/edbf06d2 branch from 95b9ca7 to b1ca544 Compare August 7, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants