Skip to content

Clean_up related to symex_assign_symbol #4793

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

Conversation

romainbrenguier
Copy link
Contributor

There is no functional changes, this is just aimed at making the code a bit simpler

  • Each commit message has a non-empty body, explaining why the change was made.
  • [na] Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • [na] 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).
  • [na] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • [na] White-space or formatting changes outside the feature-related changed lines are in commits of their 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.

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

@codecov-io
Copy link

codecov-io commented Jun 14, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@3da291c). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #4793   +/-   ##
==========================================
  Coverage           ?   68.65%           
==========================================
  Files              ?     1281           
  Lines              ?   105583           
  Branches           ?        0           
==========================================
  Hits               ?    72492           
  Misses             ?    33091           
  Partials           ?        0
Impacted Files Coverage Δ
src/goto-symex/goto_symex_state.h 100% <ø> (ø)
src/goto-symex/goto_symex_state.cpp 93.75% <ø> (ø)
src/goto-symex/ssa_step.h 92.85% <ø> (ø)
src/goto-symex/renamed.h 100% <ø> (ø)
src/goto-symex/renaming_level.h 50% <ø> (ø)
src/util/ssa_expr.h 100% <ø> (ø)
src/goto-symex/symex_target_equation.cpp 95.16% <100%> (ø)
src/goto-symex/renaming_level.cpp 91.8% <100%> (ø)
src/goto-symex/symex_assign.cpp 85.2% <100%> (ø)
src/util/ssa_expr.cpp 87.5% <100%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3da291c...71caf32. Read the comment docs.

}
return state.rename(std::move(guarded_rhs), ns).get();
}();
guard.empty() ? rhs : (exprt)if_exprt{conjunction(guard), rhs, lhs}, ns)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer static_cast<exprt> as the C-style cast is just very easy to overlook.

@@ -231,7 +230,7 @@ SSA_assignment_stept::SSA_assignment_stept(
original_full_lhs = std::move(_original_full_lhs);
ssa_rhs = std::move(_ssa_rhs);
assignment_type = _assignment_type;
cond_expr = std::move(_cond_expr);
cond_expr = equal_exprt(ssa_lhs, ssa_rhs);
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: use curly braces

const exprt assignment_guard =
make_and(state.guard.as_expr(), conjunction(guard));

const exprt original_lhs = get_original_name(l2_full_lhs);
target.assignment(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Random place: typo in the commit message: "this values" -> "these values", and also it should be "Inline variables" (plural)

{
level2.current_names.insert(l1_identifier, std::make_pair(lhs, n));
std::pair<ssa_exprt, unsigned> copy = r_opt->get();
copy.second = narrow<unsigned>(n);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ack, but we should really stop using unsigned, the renaming index ought to be std::size_t.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tautschnig I added that change in a new commit

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@@ -217,7 +217,7 @@ class goto_symex_statet final : public goto_statet
unsigned remaining_vccs = 0;

/// Allocates a fresh L2 name for the given L1 identifier, and makes it the
// latest generation on this path.
/// latest generation on this path.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note on the commit message: that's a "slash", not a "backslash"

@romainbrenguier romainbrenguier force-pushed the clean-up/symex-assign-symbol branch 2 times, most recently from 980910b to 5e22d89 Compare June 17, 2019 07:47
This intermediary variable doesn't help understanding and slows down
reading the code.
Makes it clearer why it is declared.
ns.lookup doesn't do the assignment
The definition of this reference is not useful.
We can deduce it from the assignment type rather than having to give it
to the constructor.
This can be deduced fro lhs and rhs without having to give it to the
constructor.
Declaring variables for these values doesn't add clarity and makes the
function longer.
Add missing const, necessary narrow and insert if and else to make r_opt
scoped to only the if branch.
No functional changes.
Necessary for doxygen comment
This avoids some conversions, in particular when assigning from the
return value of fresh_l2_name_provider.
@romainbrenguier romainbrenguier force-pushed the clean-up/symex-assign-symbol branch from 5e22d89 to 71caf32 Compare June 17, 2019 11:03
@romainbrenguier romainbrenguier merged commit 5bd95a7 into diffblue:develop Jun 17, 2019
@romainbrenguier romainbrenguier deleted the clean-up/symex-assign-symbol branch June 17, 2019 12:45
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: 71caf32).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/115789758

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.

6 participants