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

Show SSA deletes the databus #6227

Closed
sirasistant opened this issue Oct 4, 2024 · 2 comments · Fixed by #6249
Closed

Show SSA deletes the databus #6227

sirasistant opened this issue Oct 4, 2024 · 2 comments · Fixed by #6249
Assignees
Labels
bug Something isn't working

Comments

@sirasistant
Copy link
Contributor

Aim

Compiling functions that use the databus with --show-ssa

Expected Behavior

Function should not be modified

Bug

Databus is removed

Compiled ACIR for main (unoptimized):
func 0
current witness index : 2
private parameters indices : [0, 1]
public parameters indices : []
return value indices : []
BLACKBOX::RANGE [(0)] [ ]
BLACKBOX::RANGE [(1)] [ ]
EXPR [ (1, _0) (-1, _2) 1 ]
BLACKBOX::RANGE [(2)] [ ]
EXPR [ (-1, _1) (1, _2) 0 ]

(no init calldata or returndata shown anymore)

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

No response

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@sirasistant sirasistant added the bug Something isn't working label Oct 4, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Oct 4, 2024
@asterite
Copy link
Collaborator

asterite commented Oct 8, 2024

I found that the "normalize IDs" SSA pass doesn't populate the DataBus structure of a function dfg:

Function::clone_signature(new_id, function)

pub(crate) fn clone_signature(id: FunctionId, another: &Function) -> Self {
let mut new_function = Function::new(another.name.clone(), id);
new_function.runtime = another.runtime;
new_function
}

Doing a simple clone() doesn't work because the IDs change, so we have to replace the IDs in that data structure too.

@jfecher I'll try, but someone with more knowledge about this DataBus type might be able to do it faster.

@asterite
Copy link
Collaborator

asterite commented Oct 8, 2024

Actually, maybe it's not that hard, there's IdMaps which maps the IDs... I'll try :-)

github-merge-queue bot pushed a commit that referenced this issue Oct 9, 2024
# Description

## Problem

Resolves #6227

## Summary

## Additional Context

## Documentation

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants