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

Comments

Projects
None yet
3 participants
@zdjones
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Mar 29, 2019

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

@zdjones

This comment has been minimized.

Copy link
Contributor Author

commented Mar 29, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Mar 29, 2019

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

@gopherbot gopherbot closed this in 576442b Mar 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.