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: preempt repeated checks for zero constant in prove #31141

Closed
zdjones opened this issue Mar 29, 2019 · 3 comments
Closed

cmd/compile: preempt repeated checks for zero constant in prove #31141

zdjones opened this issue Mar 29, 2019 · 3 comments

Comments

@zdjones
Copy link
Contributor

zdjones commented Mar 29, 2019

In several heavily-used paths, prove is checking for the existence of a zero-valued constant, and creating it if not found:

  • After initialisation, prove ranges through all blocks and values, checking for the zero constant at every Value until it finds one. A similar check is also done here for every string len, slice len, and slice cap op.
  • factTable.isNonNegative contains a similar check needed to take advantage of the poset.

I’d like to clean this up in two ways:

  1. Preempt all these checks by finding or creating the zero constant Value when the factsTable is initialised on entry to prove().
  2. Use a method from func.go, func.ConstInt64(), that takes care of locating an extant value or creating one if necessary.

(On mobile, will fix formatting and add details/links when back to keyboard)

cc/ @rasky @josharian @mvdan

@josharian
Copy link
Contributor

Yes please. No need to add more detail here, just do it. This was also discussed in passing at #25086

@zdjones
Copy link
Contributor Author

zdjones commented Mar 29, 2019 via email

@gopherbot
Copy link

Change https://golang.org/cl/170118 mentions this issue: cmd/compile: preempt repeated checks for the zero constant in prove

@golang golang locked and limited conversation to collaborators Mar 28, 2020
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