-
Notifications
You must be signed in to change notification settings - Fork 274
Simplifier: new interface, final piece [blocks: #4904] #4874
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
f825da3
to
6163a70
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: 6163a70).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/118008202
Codecov Report
@@ Coverage Diff @@
## develop #4874 +/- ##
==========================================
Coverage ? 69.19%
==========================================
Files ? 1307
Lines ? 107952
Branches ? 0
==========================================
Hits ? 74697
Misses ? 33255
Partials ? 0
Continue to review full report at Codecov.
|
acbd1ad
to
f1e14a8
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: f1e14a8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/118066179
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: 7e5fb17).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/118194547
f9e72a5
to
aadd948
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.
This PR failed Diffblue compatibility checks (cbmc commit: f9e72a5).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/118196021
Status will be re-evaluated on next push.
Common spurious failures include: 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); compatibility was already broken by an earlier merge.
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: aadd948).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/118196970
f3bf107
to
c5d779c
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: e6b904d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119026152
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: b8bc1b8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119026200
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.
This PR failed Diffblue compatibility checks (cbmc commit: f3bf107).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119026998
Status will be re-evaluated on next push.
Common spurious failures include: 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); compatibility was already broken by an earlier merge.
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: 27b0fda).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119027357
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: c5d779c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119027533
Expressions should not be given a type() child if they don't have one.
This improves type safety.
These have tight coupling, and there is a sufficient number of them.
c5d779c
to
cb9dbc4
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: cb9dbc4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119040141
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.
Overall looks good, except for a couple of bugs where a changed(...)
is missing - see detailed comments.
src/util/simplify_expr_array.cpp
Outdated
@@ -31,86 +36,77 @@ bool simplify_exprt::simplify_index(exprt &expr) | |||
index.op0().op1()==index.op1()) | |||
{ | |||
exprt tmp=index.op0().op0(); | |||
expr.op1()=tmp; | |||
index = 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.
I don't think tmp
carries any value anymore.
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.
done
src/util/simplify_expr_array.cpp
Outdated
no_change = false; | ||
} | ||
else if(index.op0().id()==ID_mult && | ||
index.op0().operands().size()==2 && | ||
index.op0().op0()==index.op1()) | ||
{ | ||
exprt tmp=index.op0().op1(); | ||
expr.op1()=tmp; | ||
index = 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.
Get rid of 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.
done
src/util/simplify_expr_array.cpp
Outdated
} | ||
|
||
if_exprt if_expr(equality_expr, with_expr.new_value(), new_index_expr); | ||
expr = simplify_if(if_expr).expr; | ||
return false; | ||
return simplify_if(if_expr).expr; |
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 might not make much of a difference, but elsewhere we seem to use return changed(simplify_if(if_expr));
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.
ok
src/util/simplify_expr_int.cpp
Outdated
return simplify_inequality(expr); | ||
auto new_expr = expr; | ||
new_expr.op0().swap(new_expr.op1()); | ||
return simplify_inequality(new_expr); // recursive call |
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.
return changed(simplify_inequality(new_expr));
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.
ok
src/util/simplify_expr_struct.cpp
Outdated
auto new_member_expr = expr; | ||
new_member_expr.op0() = new_operands.front(); | ||
// do this recursively | ||
return simplify_member(new_member_expr); |
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.
return changed(simplify_member(new_member_expr));
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.
ok
src/util/simplify_expr_struct.cpp
Outdated
return false; | ||
auto new_expr = expr; | ||
new_expr.op0() = op.op0(); | ||
return simplify_member(new_expr); |
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.
return changed(simplify_member(new_expr));
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.
ok
src/util/simplify_expr.cpp
Outdated
@@ -103,24 +103,24 @@ simplify_exprt::resultt<> simplify_exprt::simplify_abs(const abs_exprt &expr) | |||
return unchanged(expr); | |||
} | |||
|
|||
simplify_exprt::resultt<> simplify_exprt::simplify_sign(const exprt &expr) | |||
simplify_exprt::resultt<> simplify_exprt::simplify_sign(const sign_exprt &expr) | |||
{ | |||
if(expr.operands().size()!=1) | |||
return unchanged(expr); |
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.
I don't think this should be necessary anymore.
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.
removed
src/util/simplify_expr_int.cpp
Outdated
@@ -771,32 +771,31 @@ simplify_exprt::resultt<> simplify_exprt::simplify_bitwise(const exprt &expr) | |||
return std::move(new_expr); | |||
} | |||
|
|||
simplify_exprt::resultt<> simplify_exprt::simplify_extractbit(const exprt &expr) | |||
simplify_exprt::resultt<> | |||
simplify_exprt::simplify_extractbit(const extractbit_exprt &expr) | |||
{ | |||
PRECONDITION(expr.id() == ID_extractbit); |
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.
No longer necessary.
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.
removed
src/util/simplify_expr_struct.cpp
Outdated
const irep_idt &component_name= | ||
to_member_expr(expr).get_component_name(); | ||
|
||
const exprt &op = expr.op0(); | ||
const exprt &op = expr.struct_op(); |
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.
Use .compound()
, struct_op
carries a comment that "it will go away" (repeats below)
This improves type safety.
This improves memory safety.
This improves memory safety.
This improves memory safety.
This improves memory safety.
This improves memory safety.
This improves memory safety.
This improves memory safety.
This improves memory safety.
This improves type safety.
This improves type safety.
Follow-up from comment in #4872. The call is a no-op.
This improves type safety.
cb9dbc4
to
412754c
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: 412754c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119063508
Reviewers of this series of PRs will be pleased to note that now all cases use the new interface.
Left to do is
simplify_node
andsimplify_rec
, and some auxiliary methods.-n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/