-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: unneccesary 0 check in division #45928
Comments
cc @zdjones as this seems likely to be prove-related |
Change https://go.dev/cl/410336 mentions this issue: |
The merged CL was reverted recently in https://go-review.googlesource.com/c/go/+/463295 due to #57959. Reopening the issue, as presumably we still want to try improving the prove pass. |
@randall77 from your comment at #57959 (comment)
I tried something like this, and it bring the slowness from 100x to 10x, still seems not worth to do that. |
@randall77 maybe we can update fact table if either arguments of |
Sure, that would be a simple rule. How many facts does it add to the table? How much slowdown? |
For the repo in #57959, there's 2s slowdown:
Nearly 200 facts added:
|
Change https://go.dev/cl/483359 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
AFAIK I run the latest, havnt tried on tip.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
I expected the compiler to be smart enough to know that
x | (1 << 31)
would never be 0, as it should be quite obvious.What did you see instead?
Most notibly:
This is a 0 check that I did not expect to see.
It sounds quite plausible to me that the compiler only checks for non-0 constants to remove this check. I think that when it is so explicitly not 0, the compiler should be able to figure this one out.
The text was updated successfully, but these errors were encountered: