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

Brillig function calls with all constant inputs result in false positives for SSA connectedness check #5518

Open
TomAFrench opened this issue Jul 15, 2024 · 0 comments

Comments

@TomAFrench
Copy link
Member

TomAFrench commented Jul 15, 2024

Consider the program

fn main() {
    assert_eq(foo(5), 5);
}

unconstrained fn foo(_x: Field) -> Field {
    5
}

This currently compiles down to an empty circuit as during ACIR generation we determine that the call to foo has constant arguments so we replace it with the expected output 5. However as of the end of the SSA passes (and so when @Rumata888's #5402 runs) the program looks like the below

acir(inline) fn main f0 {
  b0():
    v7 = call f1(Field 5)
    constrain v7 == Field 5
    return 
}
brillig fn foo f1 {
  b0(v0: Field):
    return Field 5
}

We can't quick fix this by just considering that brillig functions which have all constant inputs are connected to their outputs as the function could include foreign calls, etc. However we should be able to attempt execution of this brillig call in SSA similarly to how we do during ACIR generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant