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

constant folding: FuncDefns and FuncDecls are not considered needed #1797

Open
doug-q opened this issue Dec 17, 2024 · 2 comments
Open

constant folding: FuncDefns and FuncDecls are not considered needed #1797

doug-q opened this issue Dec 17, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@doug-q
Copy link
Collaborator

doug-q commented Dec 17, 2024

In find_needed_nodes

On reflection this is not entirely true. We consider all incoming edges of a needed node to come from needed nodes. So a FuncDefn/Decl is needed if it's called by a needed node.

The issue is that "main" (or more generally, public functions) are not considered needed.

Constant folding already special cases the inputs of "main", we should at least special case that "main" is needed.

@acl-cqc
Copy link
Contributor

acl-cqc commented Dec 30, 2024

Is it worth generalizing this to "establish a convention/API for indicating the entry-points to a Hugr" i.e. not just for constant folding but generally? (DCE/DeadFuncElim, etc. etc.) - see also #1752

@acl-cqc
Copy link
Contributor

acl-cqc commented Dec 30, 2024

and/or does it suffice to change this line:

q.push_back(h.root());

to look for main if the root is not a DFG/function but a module?

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
None yet
Development

Successfully merging a pull request may close this issue.

2 participants