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

Multiple type/function rewriting passes don't respect declaration order #5139

Open
vlstill opened this issue Feb 21, 2025 · 0 comments
Open
Labels
bug This behavior is unintended and should be fixed.

Comments

@vlstill
Copy link
Contributor

vlstill commented Feb 21, 2025

This a more general instance of the problem fixed for SpecializeGenericTypes in #5133. In general, when struct type or function is "instanciated" with concrete types, or types are replaced, the instantiation can introduce new dependency on a new type and therefore it needs to be inserted after it. Furthermore, if multiple insertions happen at the same point in the program, their respective order does matter, as there may be similar definition requirements between them.

It seems that at least SpecializeGenericFunctions and EliminateTuples is affected, but possibly more. Ideally, we would want to factor out the common parts and implement only the specific once, but I don't have time for that (at least not now). Namely at least the insertion part should be factorable for any pass that inserts global objects that can have dependencies.

Example that breaks tuple elimination (it duplicates struct) type-spec-nested-complex.p4.txt

@fruffy fruffy added the bug This behavior is unintended and should be fixed. label Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This behavior is unintended and should be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants