-
Notifications
You must be signed in to change notification settings - Fork 131
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
Python frontend fixes for return values and arguments #1834
Conversation
@phschaad when reviewing, keep the following code in mind (I couldn't reproduce such a situation, you are more qualified to do so): is there any case where the top-level CFG target is an SDFG, and we still create a terminator ( I want to make sure that creating a terminator (like the |
dace/frontend/python/newast.py
Outdated
ast_name = ast.copy_location(ast.Name(id='__return'), node) | ||
self._visit_assign(new_node, ast_name, None, is_return=True) | ||
else: # No return value | ||
pass | ||
|
||
if not isinstance(self.cfg_target, SDFG): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phschaad Comment in PR refers to this code.
@tbennun There isn't currently something in the frontend that consciously does it that way, but having a return block followed by other content is still valid and works similar to how it would work in Python - i.e., the program exits and everything following is dead code. On a separate branch I currently have even augmented dead state elimination to take that into account and kill more unreachable states. I have thus augmented the PR slightly to insert such a return block now to make the feature airtight. |
return
statements without a return value