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

Remove redundant Return node after processing an ASR through subroutine_from_function pass #2420

Closed
anutosh491 opened this issue Nov 12, 2023 · 1 comment · Fixed by #2421

Comments

@anutosh491
Copy link
Collaborator

From #2419

When we go from

def func() -> S:
    return pi

To something like

def func(r: Out[S]) -> None:
    r = pi

Or any cases like this where the subroutine_from_function pass is involved, we don't get rid of the redundant Return node in the function body.

                                    (=
                                        (Var 3 _lpython_return_variable)
                                        (IntrinsicScalarFunction
                                            SymbolicPi
                                            []
                                            0
                                            (SymbolicExpression)
                                            ()
                                        )
                                        ()
                                    )
                                    (Return)

Whereas x->m_return_var points to nullptr so we don't need this node.

@certik
Copy link
Contributor

certik commented Nov 14, 2023

Looks like that this is fixed now.

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