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

fix symbolic field handling by CommonSubExprElim #5

Merged
merged 5 commits into from
Oct 16, 2024

Conversation

mmcloughlin
Copy link
Owner

Fix a problem with the treatment of symbolic field variables by common-subexpression-elimination.

When a common subexpression has been identified, it needs to place it in the statement list. It does this by placing it in the first position after all its dependencies have been assigned. The problem comes because a common subexpression that depends on a symbolic field won't ever find an assignment to the symbolic field.

This is what the algorithm was probably supposed to do, but as they explain in a comment what they actually do is place the definition of the common subexpression in the first place after all its dependencies have appeared (whether assigned to or not). Therefore in practice, common expressions involving symbolic fields would end up placed after their first use.

This PR fixes it by:

  • Passing a list of globals into CSE which are treated as predefined
  • Appending symbolic fields to the global identifier set

@mmcloughlin mmcloughlin merged commit 8ca39c0 into dev Oct 16, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

1 participant