-
Notifications
You must be signed in to change notification settings - Fork 277
introduce simplify_exprt::resultt #4732
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
Conversation
Could the commit message please include a body - which might actually just what's being said in the PR description? |
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.
The commit in itself looks promising, but also it's not easy to judge without seeing it in action.
c74acf7
to
9a85e4a
Compare
@tautschnig Now with non-trivial example. |
|
||
// #define DEBUGX | ||
// #define DEBUGX |
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.
Except for this seemingly wrong/unnecessary change: could we please just have this commit merged as soon as possible? It seems like a big improvement towards readability without any immediate dependence on the other changes.
src/util/simplify_expr.cpp
Outdated
tmp.type()=new_type; | ||
expr.swap(tmp); | ||
return false; | ||
return tmp; |
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.
Do we need std::move(tmp)
here?
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.
Actually, don't we need return changed(std::move(tmp));
here?
src/util/simplify_expr.cpp
Outdated
op_type.id() == ID_floatbv ? ID_ieee_float_notequal : ID_notequal, | ||
from_integer(0, op_type)); | ||
inequality.add_source_location()=expr.source_location(); | ||
simplify_node(inequality); | ||
expr.swap(inequality); | ||
return false; | ||
return inequality; |
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.
Unless I'm mistaken this needs a lot more use of std::move
at about any return statement?
9a85e4a
to
09d5555
Compare
This is follow-up on #2939 and #2946, and the biggest change to the simplifier since its existence. It attempts to make the implementation of individual simplification steps more type safe, as opposed to using exprt. The alternative considered was to return optionalt<exprt>, which has the disadvantage that it doesn't "chain", i.e., given two transformations f and g one cannot write f(g(...)).
The new name conveys the meaning of the variable.
09d5555
to
b440b66
Compare
b440b66
to
23bfef1
Compare
The std::move are added! |
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: 23bfef1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/114390981
This is follow-up on #2939 and #2946, and the biggest change to the simplifier since its existence.
It attempts to make the implementation of individual simplification steps more type safe, as opposed to using
exprt
.The alternative considered was to return
optionalt<exprt>
, which has the disadvantage that it doesn't "chain", i.e., given two transformationsf
andg
one cannot writef(g(...))
.