Skip to content

Byte-operator lowering: use lambda_exprt for non-constant width #4651

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 4 commits into from
May 22, 2019

Conversation

tautschnig
Copy link
Collaborator

This PR does/has to do a couple of things (please review commit-by-commit):

  • Introduce a proper API for lambda expressions
  • Add support for lambda expressions to the array theory
  • Use lambda expressions to encode byte-operator applications of non-constant width
  • 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.

expr.swap(tmp);
simplify_rec(expr);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this in the wrong commit? It doesn't match the commit message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fair point, I have put it into a commit of its own.

Copy link
Contributor

@allredj allredj left a 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: f445df5).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/111703192
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.

Copy link
Contributor

@allredj allredj left a 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: 72fa110).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/111728575
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.

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.

Yes; this could give a significant improvement in performance.

@@ -4460,4 +4460,78 @@ inline cond_exprt &to_cond_expr(exprt &expr)
return ret;
}

/// \brief Construct an array from an anonymous function
Copy link
Contributor

Choose a reason for hiding this comment

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

It's good that there is a comment here, but it isn't enough that I can figure out what it does. Why is it always an array? Is it because it's used in flattening?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in #4672, which now takes care of the initial commits in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, I find that much clearer

@tautschnig tautschnig changed the title Byte-operator lowering: use lambda_exprt for non-constant width Byte-operator lowering: use lambda_exprt for non-constant width [depends-on: #4672] May 19, 2019
@tautschnig tautschnig assigned tautschnig and unassigned smowton and kroening May 19, 2019
tautschnig added a commit that referenced this pull request May 19, 2019
Add an API for lambda expressions [blocks: #4651]
@tautschnig tautschnig changed the title Byte-operator lowering: use lambda_exprt for non-constant width [depends-on: #4672] Byte-operator lowering: use lambda_exprt for non-constant width May 19, 2019
Copy link
Contributor

@allredj allredj left a 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: 89afd23).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/112376060
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.

Array comprehension expressions are very useful to construct arrays of
unbounded size. To support this use case, the array theory in the bit
blasting back-end needs to handle them.
This case shouldn't actually occur, and is thus now an invariant rather
than half-supporting it and otherwise failing with an exception. This is
a first step towards getting rid of the remaining exceptions in
byte-operator lowering.
Arrays with non-constant size are now encoded using array
comprehensions.  This lifts the prior limit of only being able to
perform byte updates when at least the size of the update or the size of
the target was known.
The two remaining cases really _are_ invariants.
@tautschnig tautschnig merged commit 3fbbbea into diffblue:develop May 22, 2019
@tautschnig tautschnig deleted the use-lambda branch May 22, 2019 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants