-
Notifications
You must be signed in to change notification settings - Fork 277
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
Clean-up symex assignments #4735
Conversation
src/goto-symex/symex_assign.cpp
Outdated
@@ -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> |
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.
Please sort lexicographically (I'm pretty sure clang-format will block on this)
e273c91
to
578733f
Compare
// Temporarily add the state guard | ||
guard.emplace_back(state.guard.as_expr()); | ||
const exprt assignment_guard = | ||
make_and(state.guard.as_expr(), conjunction(guard)); |
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.
Presumably this was done this way in the name of performance. Have you checked that your change doesn't noticeably slow symex down?
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.
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.
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.
@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?
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.
It seems good, once I saw from exprt::is_true()
that boolean constant exprt
s must be either true_exprt
or false_exprt
.
@romainbrenguier This now needs a rebase, which I guess would also sort out the CI failure (it's a spurious clang-format report). |
591f13d
to
fea850a
Compare
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
fea850a
to
63e01d9
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 63e01d9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/114089912
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.