Skip to content

Conversation

@kroening
Copy link
Collaborator

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a 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.

u_rhs.copy_to_operands(guard);
u_rhs.copy_to_operands(merge[j]);
u_rhs.op0().make_not();
u_rhs.add_to_operands(not_exprt(guard), merge[j]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

make_not is slightly different to this one - maybe use boolean_negate instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

if(
to_bitvector_type(typecast_expr.type()).get_width() >=
to_bitvector_type(typecast_expr.op().type()).get_width())
return build_string(typecast_expr.op());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit pick: please add braces for readability

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

if(expr.type().id()==ID_signedbv ||
expr.type().id()==ID_unsignedbv)
if(
typecast_expr.type().id() == ID_signedbv ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion that I shouldn't be making because out-of-scope for this PR: we use typecast_expr.type().id() and typecast_expr.op().type().id() several times in here, maybe add some temporaries?

{
assert(expr.operands().size()==1);
return build_string(expr.op0())+"."+expr.get_string(ID_component_name);
return build_string(to_member_expr(expr).struct_op()) + "." +
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe .struct_op() is deprecated in favour of .compound() (here and below).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

{
assert(expr.op1().operands().size()==1);
add_type_bounds(expr.op0(), expr.op1().op0().type());
assert(equal_expr.op1().operands().size() == 1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can safely get rid of this by using to_typecast_expr below. Repeats once more below.

Copy link
Contributor

Choose a reason for hiding this comment

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

That would also get rid of the use of assert rather than INVARIANT too....

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

get_object(expr.op1(), p.second))
if(
get_object(equal_expr.op0(), p.first) ||
get_object(equal_expr.op1(), p.second))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit pick: please add braces for readability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

get_object(expr.op1(), p.second))
if(
get_object(notequal_expr.op0(), p.first) ||
get_object(notequal_expr.op1(), p.second))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit pick: please add braces for readability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@chrisr-diffblue chrisr-diffblue left a comment

Choose a reason for hiding this comment

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

I agree with the comments Michael made, but otherwise looks like a nice cleanup to me.

{
assert(expr.op1().operands().size()==1);
add_type_bounds(expr.op0(), expr.op1().op0().type());
assert(equal_expr.op1().operands().size() == 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

That would also get rid of the use of assert rather than INVARIANT too....

@kroening kroening force-pushed the expr-op-cleanup branch 3 times, most recently from 133bdb3 to 480544c Compare November 26, 2018 23:53
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.

✔️
Passed Diffblue compatibility checks (cbmc commit: 480544c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92626177

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.

✔️
Passed Diffblue compatibility checks (cbmc commit: 0942e1f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92649557

@tautschnig tautschnig merged commit d314770 into develop Nov 27, 2018
@tautschnig tautschnig deleted the expr-op-cleanup branch November 27, 2018 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants