Skip to content

added instructiont::set_X #4205

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
merged 1 commit into from
Feb 20, 2019
Merged

added instructiont::set_X #4205

merged 1 commit into from
Feb 20, 2019

Conversation

kroening
Copy link
Member

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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.

✔️
Passed Diffblue compatibility checks (cbmc commit: cec23bf).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/101189026

@@ -1046,13 +1046,13 @@ void string_abstractiont::move_lhs_arithmetic(exprt &lhs, exprt &rhs)

goto_programt::targett string_abstractiont::abstract_pointer_assign(
goto_programt &dest,
goto_programt::targett target)
const goto_programt::targett target)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this rather be goto_programt::const_targett target - adding the const to an object passed by value doesn't add much (other than forbidding the operator++ application below)?

@tautschnig tautschnig assigned kroening and unassigned tautschnig Feb 17, 2019
@kroening kroening force-pushed the get_set_instructiont_code branch from cec23bf to 27d96c5 Compare February 17, 2019 09:08
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.

✔️
Passed Diffblue compatibility checks (cbmc commit: 27d96c5).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/101217016

constant_propagator_domaint::partial_evaluate(d.values, arg, ns);
}

it->set_function_call(call);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one could also be made conditional, though it requires an additional Boolean to track whether any modification took place.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did contemplate it, and arrived at the conclusion that the "set" is likely cheaper than the Boolean logic.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The set_function_call might be cheap, but the problem with breaking sharing is that you pay the price multiple times: every time the expression is stored in a std::unordered_set or std::unordered_map the operator== becomes more expensive, because pointer-comparison cannot be used. There is of course a question whether this expression is shared, but it quite possibly is if the function has multiple call sites. Destroying sharing will thus make writing the simplified goto binary more expensive.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, now with boolean logic

@kroening kroening force-pushed the get_set_instructiont_code branch from 27d96c5 to 331c449 Compare February 19, 2019 10:06
This avoids accidental disruption of sharing.
@tautschnig tautschnig merged commit 60fe468 into develop Feb 20, 2019
@tautschnig tautschnig deleted the get_set_instructiont_code branch February 20, 2019 15:42
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.

7 participants