Skip to content
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

Fix block merge under loop #3770

Merged
merged 1 commit into from
Jul 25, 2023

Conversation

spapinistarkware
Copy link
Collaborator

@spapinistarkware spapinistarkware commented Jul 25, 2023

This change is Reviewable

@spapinistarkware
Copy link
Collaborator Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 6 files at r1, all commit messages.
Reviewable status: 3 of 6 files reviewed, 3 unresolved discussions (waiting on @spapinistarkware)


crates/cairo-lang-lowering/src/lower/block_builder.rs line 100 at r1 (raw file):

        );
        self.changed_semantics.insert(member_path);
    }

Suggestion:

    pub fn update_ref(
        &mut self,
        ctx: &mut LoweringContext<'_, '_>,
        member_path: &ExprVarMemberPath,
        var: VariableId,
    ) {
        let location = ctx.get_location(member_path.stable_ptr().untyped());
        self.update_ref_raw(ctx, member_path, var, location)
    }

    pub fn update_ref_raw(
        &mut self,
        ctx: &mut LoweringContext<'_, '_>,
        member_path: MemberPath,
        var: VariableId,
        location: LocationId,
    ) {
        self.semantics.update(
            BlockStructRecomposer { statements: &mut self.statements, ctx, location },
            &member_path,
            var,
        );
        self.changed_semantics.insert(member_path);
    }

crates/cairo-lang-lowering/src/lower/block_builder.rs line 114 at r1 (raw file):

            )
            .map(|var_id| VarUsage { var_id, location })
    }

Suggestion:

    pub fn get_ref(
        &mut self,
        ctx: &mut LoweringContext<'_, '_>,
        member_path: &ExprVarMemberPath,
    ) -> Option<VarUsage> {
        let location = ctx.get_location(member_path.stable_ptr().untyped());
        self.get_ref_raw(ctx, member_path, location)
    }

crates/cairo-lang-lowering/src/lower/refs.rs line 15 at r1 (raw file):

#[derive(Clone, Default, Debug)]
pub struct SemanticLoweringMapping {
    pub scattered: OrderedHashMap<MemberPath, Value>,

is this used?

Suggestion:

pub struct SemanticLoweringMapping {
    scattered: OrderedHashMap<MemberPath, Value>,

@spapinistarkware spapinistarkware force-pushed the spapini/07-25-Fix_block_merge_under_loop branch from e2dc346 to fc1b6fc Compare July 25, 2023 11:26
Copy link
Collaborator Author

@spapinistarkware spapinistarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 3 of 6 files reviewed, 3 unresolved discussions (waiting on @orizi)


crates/cairo-lang-lowering/src/lower/block_builder.rs line 100 at r1 (raw file):

        );
        self.changed_semantics.insert(member_path);
    }

Done.


crates/cairo-lang-lowering/src/lower/block_builder.rs line 114 at r1 (raw file):

            )
            .map(|var_id| VarUsage { var_id, location })
    }

Done.


crates/cairo-lang-lowering/src/lower/refs.rs line 15 at r1 (raw file):

Previously, orizi wrote…

is this used?

Done.

@spapinistarkware spapinistarkware force-pushed the spapini/07-25-Fix_block_merge_under_loop branch from fc1b6fc to f5eb8ab Compare July 25, 2023 11:44
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 6 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @spapinistarkware)

@spapinistarkware spapinistarkware added this pull request to the merge queue Jul 25, 2023
Merged via the queue into main with commit ab793f5 Jul 25, 2023
38 checks passed
@orizi orizi deleted the spapini/07-25-Fix_block_merge_under_loop branch August 2, 2023 04:48
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.

bug: program behavior changes based on how variables are read
2 participants