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

CSE to avoid repeated pure function calls with the same argument #4

Open
casella opened this issue Jun 12, 2023 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@casella
Copy link
Contributor

casella commented Jun 12, 2023

If the same pure function call with the same argument is present in multiple places in the Modelica source code, Common Subexpression Elimination should be applied to avoid useless repeated function calls, which are guaranteed to give the same output.

One way to implement this feature is the method employed in OpenModelica: for each function call, an equation $cseXX = function_call() is generated and an auxiliary variable $cseXX is added to the problem. Then, all function calls are replaced by the $cseXX variable. Matching and sorting then ensures that the function is called in the proper order.

@casella casella added the enhancement New feature or request label Jun 12, 2023
@mscuttari mscuttari self-assigned this Jul 31, 2024
@mscuttari
Copy link
Member

@arrangabriel The function-cse branch contains a starting point for the work. There is already a first implementation of expressions equivalence checks, and a scheleton for the transformation pass. You can keep working on that feature branch.

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

No branches or pull requests

3 participants