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

Use optimized overflow operation everywhere #2405

Merged
merged 7 commits into from
Apr 28, 2023

Conversation

celinval
Copy link
Contributor

@celinval celinval commented Apr 25, 2023

Description of changes:

This is related to the performance degradation we are seeing in the toolchain upgrade: #2293

Resolved issues:

Towards #1483. There are a few remaining instances of add_overflow and mul_overflow in intrinsics.rs.

Related RFC:

Optional #ISSUE-NUMBER.

Call-outs:

This PR has a side effect of removing redundant checks inserted by CBMC for checked arithmetic operations.

Testing:

  • How is this change tested? Existing tests and manual tests with my other branch where I'm doing the upgrade

  • Is this a refactor change? yes

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

This is related to the performance degradation we are seeing in the
toolchain upgrade: model-checking#2293
@celinval celinval requested a review from a team as a code owner April 25, 2023 22:27
@celinval
Copy link
Contributor Author

It looks like the performance is not always better... :(

@celinval
Copy link
Contributor Author

I do wonder if this proof is also somewhat unstable. I noticed that in my other PR (#2407) that had minimum changes to the model, there was also a performance degradation of 47% for the same test.

Copy link
Member

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to ask for an explanation as to why the no-longer-failing checks are ok.

cprover_bindings/src/goto_program/expr.rs Outdated Show resolved Hide resolved
tests/ui/cbmc_checks/signed-overflow/expected Outdated Show resolved Hide resolved
Copy link
Contributor

@zhassan-aws zhassan-aws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been on my to-do list for too long. Thanks for taking care of it @celinval!

You should add in the PR description "Towards #1483". There are a few remaining instances of add_overflow and mul_overflow in intrinsics.rs (and possibly elsewhere).

cprover_bindings/src/goto_program/expr.rs Outdated Show resolved Hide resolved
cprover_bindings/src/goto_program/expr.rs Outdated Show resolved Hide resolved
tests/ui/cbmc_checks/signed-overflow/expected Outdated Show resolved Hide resolved
- Revert shift checks expectations that were removed.
- Improve comments
@celinval
Copy link
Contributor Author

I'd like to ask for an explanation as to why the no-longer-failing checks are ok.

That's fair! My bad, I should've added an explanation before. I added it as part of an answer to one of your question and addressed the issue in the call-out section. In a nutshell, the arithmetic check that was being added by CBMC was redundant.

@celinval celinval enabled auto-merge (squash) April 28, 2023 15:54
@celinval celinval merged commit 24c7076 into model-checking:main Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants