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
Simplify BigInt power2 API #1532
Conversation
…er2() Simplified code is good code.
5653f70
to
5a362ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fbrausse: thanks for submitting this PR.
Shall we consider adding some regression tests here?
Shall we also run it over the sv-comp benchmarks?
sv-comp is running: https://github.com/esbmc/esbmc/actions/runs/7059767336 Regarding regression tests I'm not sure what to test exactly. There were some unmet assumptions in the |
stats-30s.txt:
This PR:
Mostly timeout fluctuation. About the incorrect:
|
Thanks for submitting this PR, @fbrausse. |
This PR:
1 << n
by BigInt arithmetic, andsetPower2()
function and replaced it withpower2()
andpower2m1()
. Additionally, the unaryoperator-
on BigInt now takes its argument by-value, thereby preventing additional copies for things like-BigInt::power2(n)
.I've also added a few assertions in code that was using the power2 API, mainly related to concat2t. This one used to take signedbvs, but the expr2 simplification code assumed unsigned (or at least the same sign). As it's not entirely clear what signedbv concatenation is supposed to be (sign bits extend arbitrarily far), I've tightened the assumptions here: only unsignedbv concatenations are supported now.
For this last change a few new bitcasts are inserted. I'll run this over the benchmarks to be sure nothing breaks. Locally, this already affected a few regression tests:
--overflow-check
is not passed?fgets
stores zero-terminated strings.Edit: Sorry, the above regression test changes are only for a
-DESBMC_SVCOMP=ON
build. Without that (the default) they're unchanged. We should look into these though.