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

[Expression propagation Call] incorrect propagation of return value #340

Conversation

github-actions[bot]
Copy link
Contributor

closes #263

@github-actions github-actions bot added bug Something isn't working priority-high High priority issue labels Sep 21, 2023
@rihi rihi force-pushed the issue-263-_Expression_propagation_Call_incorrect_propagation_of_return_value branch 2 times, most recently from 3249f5c to cc6eaf0 Compare September 21, 2023 13:00
@rihi
Copy link
Collaborator

rihi commented Sep 22, 2023

This is a relative easy fix for #263, by making sure ExpressionPropagationFunctionCall::_is_call_value_used_exactly_once checks that a variable is not used multiple times by an instruction.

Initially, I wanted to use DataflowObject::requirements for the fix, but that method removes duplicated variables, making it not possible to check if a variable is used multiple times. Additionally, DataflowObject::requirements is defined as a @property, meaning I couldn't just simply add a default parameter like distinct=True, to control the behavior of removing duplicates.
Because that meant I had to re-implement that behavior into a new method basically doing the same thing, I decided to create a new visitor RequiredVariablesVisitor which would do that.
Because I did not want to fix every callsite of DataflowObject::requirements, so I kept that method, but changed it to delegate to the new visitor.

@rihi rihi marked this pull request as ready for review September 22, 2023 11:04
@rihi rihi force-pushed the issue-263-_Expression_propagation_Call_incorrect_propagation_of_return_value branch from 40cde04 to d7cebb0 Compare October 19, 2023 12:08
@rihi
Copy link
Collaborator

rihi commented Oct 19, 2023

Because removing the dependency from Expression -> RequiredVariablesVisitor as required, would mean removing the DataflowObj.requirments instance method and replacing it with a 'static' method, I decided to move the visitor logic back into the DataflowObj type hierachy.
Alternatively, each call-site of DataflowObj.requirments could have been changed to use the visitor. (Perhaps via a static helper method). I figured that we don't want to do this, because it would require modifying a lot of different unrelated files, as requirements are use quite often. Additionally it would probably be weird that all kind of properties are defined, and therefore acessed, on the DataflowObj itself, while for variable requirments, one would have to use a static helper method.

@mari-mari mari-mari merged commit 8d0a5a3 into main Oct 25, 2023
2 checks passed
@mari-mari mari-mari deleted the issue-263-_Expression_propagation_Call_incorrect_propagation_of_return_value branch October 25, 2023 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-high High priority issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Expression propagation Call] incorrect propagation of return value
2 participants