Skip to content

Simplify (T)(a?b:c) to a?(T)b:(T)c #5892

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
merged 1 commit into from
Nov 5, 2022

Conversation

tautschnig
Copy link
Collaborator

The idea of such a rule existed ever since 7285dda, but was possibly too
costly when doing it post-order for one would have to re-process
multiple sub-expressions. A pre-order rule avoids such repeat
processing.

  • 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.
  • n/a 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).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

I am a little concerned about the cost of this, esp. w.r.t. non-trivial casts like double->float or int->double. Some things like integer reduction are definitely worth doing. Is it worth restricting what types this is applied to?

@codecov
Copy link

codecov bot commented Mar 8, 2021

Codecov Report

Base: 78.02% // Head: 78.04% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (fac7964) compared to base (b19b412).
Patch coverage: 92.78% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5892      +/-   ##
===========================================
+ Coverage    78.02%   78.04%   +0.02%     
===========================================
  Files         1625     1624       -1     
  Lines       187427   187431       +4     
===========================================
+ Hits        146231   146274      +43     
+ Misses       41196    41157      -39     
Impacted Files Coverage Δ
src/cprover/cprover_parse_options.cpp 56.58% <ø> (ø)
src/cprover/generalization.cpp 84.21% <ø> (ø)
src/cprover/inductiveness.cpp 78.35% <ø> (ø)
src/cprover/propagate.cpp 74.28% <ø> (ø)
src/cprover/report_properties.cpp 88.46% <ø> (ø)
src/cprover/report_traces.cpp 89.74% <ø> (ø)
src/cprover/solver.cpp 92.00% <ø> (ø)
src/cprover/solver_progress.cpp 60.00% <ø> (ø)
src/goto-symex/field_sensitivity.h 100.00% <ø> (ø)
src/util/console.cpp 29.76% <ø> (ø)
... and 15 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tautschnig tautschnig force-pushed the simplify-typecast-if branch from 6b7d8c9 to 8599eaf Compare March 8, 2021 10:24
@tautschnig
Copy link
Collaborator Author

I am a little concerned about the cost of this, esp. w.r.t. non-trivial casts like double->float or int->double. Some things like integer reduction are definitely worth doing. Is it worth restricting what types this is applied to?

Done.

Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

I think that will avoid the most expensive cases. Thanks.

@kroening
Copy link
Member

Do we have any means to performance-benchmark?

@tautschnig tautschnig self-assigned this May 19, 2021
@tautschnig tautschnig force-pushed the simplify-typecast-if branch from 7a4c06e to e9a4cb4 Compare May 19, 2021 11:11
@tautschnig
Copy link
Collaborator Author

@kroening:

Do we have any means to performance-benchmark?

I have run all of SV-COMP's benchmarks on this branch and compared it to develop. No difference beyond the expected jitter was observable. Therefore, I'd argue that this simplification step can in some cases permit additional constant propagation without adversely affecting other verification tasks that don't contain such expressions.

@tautschnig tautschnig removed their assignment May 19, 2021
@tautschnig tautschnig force-pushed the simplify-typecast-if branch from e9a4cb4 to 512f1ce Compare August 13, 2021 11:18
The idea of such a rule existed ever since 7285dda, but was possibly too
costly when doing it post-order for one would have to re-process
multiple sub-expressions. A pre-order rule avoids such repeat
processing.
@peterschrammel peterschrammel removed their assignment Nov 5, 2022
@tautschnig tautschnig merged commit 91ea53f into diffblue:develop Nov 5, 2022
@tautschnig tautschnig deleted the simplify-typecast-if branch November 5, 2022 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants