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

Using substitution maps for provenance tracking loses info #221

Open
frabert opened this issue Feb 10, 2022 · 2 comments
Open

Using substitution maps for provenance tracking loses info #221

frabert opened this issue Feb 10, 2022 · 2 comments

Comments

@frabert
Copy link
Collaborator

frabert commented Feb 10, 2022

Master branch uses a substitutions map in each pass to keep track of how AST nodes are substituted, but this not fine-grained enough.

As an example, let's say we have a pass which turns if(!cond) { a(); } else { b(); } into if(cond) { b(); } else { a(); }: by substituting the whole IfStmt without tracking the condition, we lose information about it. Adding substitution info about the condition is not always possible due to interaction between substituting a node and one of its children at the same time.

In the decomp-api branch this is addressed by making it so that each pass keeps track of provenance on its own, but it would be nice to find a way to make the substitution map work.

@pgoodman
Copy link
Collaborator

At least in this particular case, !cond and cond relating to a br instruction is valid. It's just about different interpretations of the two successors. Are there any guarantees right now on the true target of a br actually being the if branch of the statement?

@frabert
Copy link
Collaborator Author

frabert commented Feb 10, 2022

Right now, br instructions are never the source of provenance of anything. cond would originate from the predicate of a br instruction, not the instruction itself

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

No branches or pull requests

2 participants