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

cmd/compile: only combine loads if there is a single use of each #15004

Closed
randall77 opened this issue Mar 29, 2016 · 1 comment
Closed

cmd/compile: only combine loads if there is a single use of each #15004

randall77 opened this issue Mar 29, 2016 · 1 comment

Comments

@randall77
Copy link
Contributor

When we combine loads into a single load, we need to make sure that each load we're combining only has one use. We'd like to keep the invariant that if you do:

 a := b[0]
 ...use a here...
 ...use a there...

then we're guaranteed that we use the same value of a in both places, regardless of races or whatever other nastiness is happening. In other words, we can't issue the b[0] load twice, we have to issue it only once and use the result for all occurrences of a.

The load combining rules currently violate that rule. We need to either make sure that all loads we're combining have only one use (the use of the combination value), or we extract the individual loads back from the combined load in case they are used elsewhere.

The obvious Uses==1 condition on the rewrite rule doesn't quite work, as mid-rewrite those loads have other dead uses that haven't been cleaned up yet. We need a more exact Uses count to make that condition work.

@tzneal

@bradfitz bradfitz added this to the Unplanned milestone Apr 9, 2016
@randall77
Copy link
Contributor Author

@golang golang locked and limited conversation to collaborators Apr 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants