Repository navigation
merge_value_sets: Avoid assignment when actually values can be moved - #4169
Conversation
| void merge_gotos(statet &); | ||
|
|
||
| virtual void merge_goto(const goto_statet &goto_state, statet &); | ||
| virtual void merge_goto(goto_statet &goto_state, statet &); |
There was a problem hiding this comment.
I'm not sure what's happening here because there is no documentation. If the goto_state is not supposed to be used afterwards then it would be good to make it clear, either by documenting or in the type, by forcing the argument to be movable.
There was a problem hiding this comment.
Fair, I'll work on adding documentation.
There was a problem hiding this comment.
Documentation added.
| dest.value_set=src.value_set; | ||
| // we don't actually need dest.value_set anymore, leave cleanup to later | ||
| // cleanup of goto states | ||
| dest.value_set.swap(src.value_set); |
There was a problem hiding this comment.
Why swap and not move?
There was a problem hiding this comment.
I'll try to take a look whether adding a move operator would be as easy.
There was a problem hiding this comment.
Done (just required also default-declaring a copy constructor).
allredj
left a comment
There was a problem hiding this comment.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: d951590).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100661522
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- 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).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
allredj
left a comment
There was a problem hiding this comment.
✔️
Passed Diffblue compatibility checks (cbmc commit: 8a23c84).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100662229
smowton
left a comment
There was a problem hiding this comment.
Formalise this with a move-ref and this lgtm
You may also be interested in @JohnDumbell is currently separating the concepts of fresh-l2-name (global) and current-l2-name (local), so that the L2 renaming map can be straightfowardly moved as well.
| override; | ||
|
|
||
| void merge_goto(const goto_statet &goto_state, statet &state) override; | ||
| void merge_goto(goto_statet &goto_state, statet &state) override; |
There was a problem hiding this comment.
If goto_state is indeed dying then we should pass a goto_statet &&
|
I have incorporated all the feedback and have now triggered another profiling run just to make sure this is still working as expected. @kroening @peterschrammel either of you will need to review this as well. |
|
|
||
| // gotos | ||
| /// Merge all branches joining at the current program point at the current | ||
| /// program point. It will apply \ref merge_goto for each goto state (each of |
There was a problem hiding this comment.
The end of the first sentence is repeated.
There was a problem hiding this comment.
Oops, thanks, fixed.
| if(state.guard.is_false() && !goto_state.guard.is_false()) | ||
| state.value_set = std::move(goto_state.value_set); | ||
| else if(!goto_state.guard.is_false()) | ||
| state.value_set.make_union(goto_state.value_set); |
There was a problem hiding this comment.
It would also make sense for make_union to not take a const ref, and use move instead. But that's maybe for another pull request.
There was a problem hiding this comment.
Making this impactful is a bigger task, because the internal representation of a value set is reference counted. I'll leave this for another time.
We don't need the contents of the source anymore. Running on SV-COMP's ReachSafety-ECA, this saves 741s, which is approximately 9% of the runtime of goto_symext::merge_goto.
allredj
left a comment
There was a problem hiding this comment.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: 6c9937c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100793036
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- 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).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
allredj
left a comment
There was a problem hiding this comment.
✔️
Passed Diffblue compatibility checks (cbmc commit: ad16b57).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/100800932
|
@kroening and/or @peterschrammel would you mind taking a look at this one? It's just +25/−21 and is already coming up in other PRs (#4199). |
We don't need the contents of the source anymore. Running on SV-COMP's
ReachSafety-ECA, this saves 741s, which is approximately 9% of the runtime of merge_goto.