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

Detect when args are always redundant because of another argument #27

Open
mvdan opened this issue Mar 13, 2018 · 0 comments
Open

Detect when args are always redundant because of another argument #27

mvdan opened this issue Mar 13, 2018 · 0 comments

Comments

@mvdan
Copy link
Owner

mvdan commented Mar 13, 2018

For example, take this Golang CL: https://go-review.googlesource.com/c/go/+/100455

The func was always called like:

mkinlcall(n, n.Left, n.Isddd())
mkinlcall(n, f, n.Isddd())
etc

Since the func always receives n, receiving n.Method() is redundant.

Other redundant cases that come to mind, when a func receives x:

x.Field
x[i]
x[i:j]
*x

And of course, any combination of the above.

I'm leaving x.PureMethod() and PureFunc(x) out of the list as that's a much more complex one - we'd have to figure out that the func has no side effects. I don't think SSA does this just yet.

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

No branches or pull requests

1 participant