Skip to content

Make simplify_expr take copy instead of reference #4301

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

Merged

Conversation

romainbrenguier
Copy link
Contributor

The implementation would make a copy of the argument anyway.
This makes it explicit in the type and allow the use of move by the
caller which avoids a copy.

  • Each commit message has a non-empty body, explaining why the change was made.
  • [na] Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • [na] The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • [na] White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@@ -1120,13 +1120,11 @@ bool acceleration_utilst::assign_array(
{
replace_expr(
loop_counter, from_integer(0, loop_counter.type()), lower_bound);
simplify_expr(lower_bound, ns);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch - but I'd suggest to instead make those have an effect, e.g., by using simplify instead of simplify_expr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

The implementation will make a copy of the argument anyway.
This makes it explicit in the type and allow the use of move by the
caller which avoids a copy.
The return value was ignored and thus there was no use in making these
calls, which was probably a mistake.
We use std::move in a few places where this is made possible by the
change in interface.
@romainbrenguier romainbrenguier force-pushed the refactor/simplify_expr_copy branch from 075d05e to 94b2145 Compare February 28, 2019 15:09
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 075d05e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102674819
Status will be re-evaluated on next push.
Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)

  • the author is not in the list of contributors (e.g. first-time contributors).

  • the compatibility was already broken by an earlier merge.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

⚠️
This PR failed Diffblue compatibility checks (cbmc commit: 94b2145).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102679219
Status will be re-evaluated on next push.
Common spurious failures:

  • the cbmc commit has disappeared in the mean time (e.g. in a force-push)

  • the author is not in the list of contributors (e.g. first-time contributors).

  • the compatibility was already broken by an earlier merge.

@tautschnig tautschnig merged commit 5377c2c into diffblue:develop Feb 28, 2019
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.

6 participants