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

Duplicated code with --experimental-ssa flattening pass #1420

Closed
Tracked by #1376
jfecher opened this issue May 26, 2023 · 0 comments · Fixed by #1671
Closed
Tracked by #1376

Duplicated code with --experimental-ssa flattening pass #1420

jfecher opened this issue May 26, 2023 · 0 comments · Fixed by #1671
Assignees
Labels
bug Something isn't working refactor ssa

Comments

@jfecher
Copy link
Contributor

jfecher commented May 26, 2023

Aim

Tried to use an if statement without an else:

fn main(x: bool) {
    if x {
        dep::std::println(5);
    }
    dep::std::println(6);
}

Expected Behavior

Expected the following resulting IR

fn main f1 {
  b0(v0: u1):
    v9 = call println(Field 5)
    v10 = not v0
    v12 = call println(Field 6)
    return unit 0
}

Bug

The flatten-cfg pass duplicates every instruction in the end block:

fn main f1 {
  b0(v0: u1):
    v9 = call println(Field 5)
    v10 = not v0
    v12 = call println(Field 6)
    v13 = call println(Field 6)
    return unit 0
}

To Reproduce

Installation Method

None

Nargo Version

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor ssa
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant