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: prove misses obvious facts about constants #36889

Open
josharian opened this issue Jan 30, 2020 · 2 comments
Open

cmd/compile: prove misses obvious facts about constants #36889

josharian opened this issue Jan 30, 2020 · 2 comments

Comments

@josharian
Copy link
Contributor

@josharian josharian commented Jan 30, 2020

I noticed that left shifts by a constant are not being marked as bounded by prove. Prove consults ft.limits, but ft.limits doesn't contain limits for constants. Something similar happens for some other ops with easy limits.

This is pretty straightforward to fix: Write a wrapper around ft.limits accesses that generates limits in cases like these.

I have a prototype CL of this, and it mostly helps. But before it can be mailed, I need to investigate and fix a few more minor regressions from it. (The compiler is quite sensitive to the order in which optimizations occur.)

And before doing that, I wanted to check in about whether this was even the right kind of fix here.

cc @zdjones @rasky

@rasky

This comment has been minimized.

Copy link
Member

@rasky rasky commented Jan 30, 2020

Can you try if my CL https://go-review.googlesource.com/c/go/+/196679 fixes the test case you have in mind? It does add bounds to constants

@josharian

This comment has been minimized.

Copy link
Contributor Author

@josharian josharian commented Jan 30, 2020

@rasky will do, thanks. I'll have to find it again first, so it may be a little while. :)

@cagedmantis cagedmantis added this to the Backlog milestone Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.