-
Notifications
You must be signed in to change notification settings - Fork 274
Cleanup processing and use __builtin_X_overflow #6612
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
Cleanup processing and use __builtin_X_overflow #6612
Conversation
efd093d
to
582644e
Compare
Codecov Report
@@ Coverage Diff @@
## develop #6612 +/- ##
========================================
Coverage 76.64% 76.65%
========================================
Files 1578 1578
Lines 181199 181219 +20
========================================
+ Hits 138875 138907 +32
+ Misses 42324 42312 -12
Continue to review full report at Codecov.
|
582644e
to
a932759
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.
Tiny nit-pick around naming, but feel free to ignore my personal preference there, as the code is still a massive step forward in readability.
a932759
to
1e8d3ab
Compare
Move the implementation to a method of its own. This avoids repeatedly testing the name to derive the underlying arithmetic operation. This change is to support upcoming extensions to handle further built-ins via this code path. No changes in behaviour intended with just this commit, and additional testing should ensure that this is also true for error handling. The function refactored from remains too large, and cpplint rightly complains about that, but this issue cannot be fixed in a single commit. Hence, adding an override.
…cker The models in the C library incurred unnecessary overhead in that they would do the arithmetic operation twice: once for the actual (possibly overflowing) result, and once for determining the overflow bit.
1e8d3ab
to
9d91abc
Compare
We just need to provide the declarations in case the underlying compiler isn't GCC.
The use of GCC built-ins allows us to avoid the duplicate multiplication (and addition) that __CPROVER_overflow_OP plus the actual result computation would entail.
9d91abc
to
291c72a
Compare
With thanks to @danielsn for reminding me of this: on the back of #6607 we realised that our C front-end should also make use of those GCC built-ins to avoid doing duplicate work. For the C library this may improve performance when verification tasks use
calloc
orstrtol
.Please review commit-by-commit.