Skip to content

Clean-up symex assignments #4735

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

This introduce an SSA_assignment_stept class to clarify what describes an assignment step (this could be a start to progressively split the SSA_stept class into several more specialized ones) and does some simple clean-up.

  • 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.
  • [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).
  • [na] 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.

@@ -17,6 +17,7 @@ Author: Daniel Kroening, [email protected]
#include <util/exception_utils.h>
#include <util/pointer_offset_size.h>
#include <util/simplify_expr.h>
#include <util/expr_util.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please sort lexicographically (I'm pretty sure clang-format will block on this)

// Temporarily add the state guard
guard.emplace_back(state.guard.as_expr());
const exprt assignment_guard =
make_and(state.guard.as_expr(), conjunction(guard));
Copy link
Contributor

Choose a reason for hiding this comment

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

Presumably this was done this way in the name of performance. Have you checked that your change doesn't noticeably slow symex down?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before this was adding an exprt to a vector then using this vector to make the and_exprt of the conjunction, now we first make the conjunction and then add the exprt to the vector of the and_exprt operands. So the operation are the same, just in a different order, this shouldn't impact performances.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@owen-jones-diffblue I just noticed that my change could lead to assignment_guard being TRUE && TRUE so I've added a commit to have make_and handle the constant cases, can you check that?

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems good, once I saw from exprt::is_true() that boolean constant exprts must be either true_exprt or false_exprt.

@tautschnig
Copy link
Collaborator

@romainbrenguier This now needs a rebase, which I guess would also sort out the CI failure (it's a spurious clang-format report).

@romainbrenguier romainbrenguier force-pushed the clean-up/symex-assign branch 4 times, most recently from 591f13d to fea850a Compare June 3, 2019 08:19
This is only used in symex_assign.cpp so does not need to be exposed.
The with_exprt constructor already sets the type to the array type.
Makes explicit that these won't be changed.
Without this, it is not clear what are the fields of SSA_stept which are
required to describe an assignement.
This can be useful in other modules than BDDs.
This allows guard to be constant in the signatures which makes it
explicit that it is left unmodified by the function.
This is to avoid generating expressions like TRUE && TRUE
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: 63e01d9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/114089912

@romainbrenguier romainbrenguier merged commit d8598f8 into diffblue:develop Jun 3, 2019
@romainbrenguier romainbrenguier deleted the clean-up/symex-assign branch June 3, 2019 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants