-
Notifications
You must be signed in to change notification settings - Fork 274
simplifier: eliminate casts from bool to number #4904
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
This needs #4874. |
Simplifier: new interface, final piece [blocks: #4904]
872b51a
to
26c1817
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.
Looks good, but needs tests (ideally regression tests)
fa90683
to
dd57506
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: dd57506).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119921169
Codecov Report
@@ Coverage Diff @@
## develop #4904 +/- ##
===========================================
+ Coverage 69.26% 69.26% +<.01%
===========================================
Files 1307 1307
Lines 108089 108125 +36
===========================================
+ Hits 74868 74893 +25
- Misses 33221 33232 +11
Continue to review full report at Codecov.
|
dd57506
to
dbffea7
Compare
@smowton Now with the obvious unit test. |
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: dbffea7).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/119946294
unit/util/simplify_expr.cpp
Outdated
symbol_tablet symbol_table; | ||
namespacet ns(symbol_table); | ||
|
||
// this checks that ((int)B)==1 turns into B |
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.
Suggest adding ==0
, !=1
, !=0
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, done
This usually enables subsequent simplification, e.g., ((int)B) != 0 turns into (B?1:0) != 0 and then into B?1!=0:0!=0 and then into B?true:false which then turns into B
dbffea7
to
ccfba0b
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: ccfba0b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/120426225
This usually enables subsequent simplification, e.g.,
((int)B) != 0
turns into
(B?1:0) != 0
and then into
B?1!=0:0!=0
and then into
B?true:false
which then turns into
B