mirror of
https://github.com/Z3Prover/z3
synced 2026-02-14 04:41:48 +00:00
Eliminate unnecessary copies with std::move for ref-counted types (#8591)
This commit is contained in:
parent
19ad2d5375
commit
295dbc601d
9 changed files with 12 additions and 14 deletions
|
|
@ -247,7 +247,7 @@ private:
|
|||
);
|
||||
m_app2val.insert(a, result.get()); // memoize
|
||||
m_pinned.push_back(a);
|
||||
m_pinned.push_back(result);
|
||||
m_pinned.push_back(std::move(result));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -278,9 +278,9 @@ bool naive_convex_closure::compute_closure(anti_unifier& au, ast_manager& m,
|
|||
substitute_vars_by_const(m, au.get_generalization(), const_ref, lit3);
|
||||
|
||||
expr_ref_vector args(m);
|
||||
args.push_back(lit1);
|
||||
args.push_back(lit2);
|
||||
args.push_back(lit3);
|
||||
args.push_back(std::move(lit1));
|
||||
args.push_back(std::move(lit2));
|
||||
args.push_back(std::move(lit3));
|
||||
expr_ref body_with_consts = mk_and(args);
|
||||
|
||||
// 3. replace const by var
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ namespace arith {
|
|||
expr_ref eq(m.mk_eq(x->get_expr(), y->get_expr()), m);
|
||||
if (!is_eq) eq = m.mk_not(eq);
|
||||
args.push_back(arith.mk_int(1));
|
||||
args.push_back(eq);
|
||||
args.push_back(std::move(eq));
|
||||
};
|
||||
rational lc(1);
|
||||
for (unsigned i = m_lit_head; i < m_lit_tail; ++i)
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ namespace q {
|
|||
expr_ref meq = mk_or(meqs);
|
||||
expr_ref veq = mk_or(veqs);
|
||||
assert_expr(meq);
|
||||
qb.domain_eqs.push_back(veq);
|
||||
qb.domain_eqs.push_back(std::move(veq));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,9 +139,8 @@ namespace recfun {
|
|||
*/
|
||||
void solver::disable_guard(expr* guard, expr_ref_vector const& guards) {
|
||||
SASSERT(!is_enabled_guard(guard));
|
||||
app_ref dlimit = m_util.mk_num_rounds_pred(m_num_rounds);
|
||||
expr_ref_vector core(m);
|
||||
core.push_back(dlimit);
|
||||
core.push_back(m_util.mk_num_rounds_pred(m_num_rounds));
|
||||
core.push_back(guard);
|
||||
if (!m_guard2pending.contains(guard)) {
|
||||
m_disabled_guards.push_back(guard);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace smt {
|
|||
app * eq = m.mk_eq(arg1, arg2);
|
||||
app_ref neq(m.mk_not(eq), m);
|
||||
if (std::find(lits.begin(), lits.end(), neq.get()) == lits.end()) {
|
||||
lits.push_back(neq);
|
||||
lits.push_back(std::move(neq));
|
||||
prs.push_back(mk_hypothesis(m, eq, false, arg1, arg2));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ namespace smt {
|
|||
break;
|
||||
expr_ref lit(g2l.to());
|
||||
lit = g2l(t->get_literal().get());
|
||||
cube.push_back(lit);
|
||||
cube.push_back(std::move(lit));
|
||||
t = t->parent();
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -161,9 +161,8 @@ namespace smt {
|
|||
*/
|
||||
void theory_recfun::disable_guard(expr* guard, expr_ref_vector const& guards) {
|
||||
SASSERT(!is_enabled_guard(guard));
|
||||
app_ref dlimit = m_util.mk_num_rounds_pred(m_num_rounds);
|
||||
expr_ref_vector core(m);
|
||||
core.push_back(dlimit);
|
||||
core.push_back(m_util.mk_num_rounds_pred(m_num_rounds));
|
||||
core.push_back(guard);
|
||||
if (!m_guard2pending.contains(guard)) {
|
||||
m_disabled_guards.push_back(guard);
|
||||
|
|
@ -418,7 +417,7 @@ namespace smt {
|
|||
if (u().has_rec_defs() || !m_disabled_guards.empty()) {
|
||||
app_ref dlimit = m_util.mk_num_rounds_pred(m_num_rounds);
|
||||
TRACEFN("add_theory_assumption " << dlimit);
|
||||
assumptions.push_back(dlimit);
|
||||
assumptions.push_back(std::move(dlimit));
|
||||
for (expr* e : m_disabled_guards)
|
||||
assumptions.push_back(m.mk_not(e));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3350,7 +3350,7 @@ void theory_seq::add_theory_assumptions(expr_ref_vector & assumptions) {
|
|||
expr_ref dlimit = m_sk.mk_max_unfolding_depth(m_max_unfolding_depth);
|
||||
m_trail_stack.push(value_trail<literal>(m_max_unfolding_lit));
|
||||
m_max_unfolding_lit = mk_literal(dlimit);
|
||||
assumptions.push_back(dlimit);
|
||||
assumptions.push_back(std::move(dlimit));
|
||||
for (auto const& kv : m_length_limit_map) {
|
||||
if (kv.m_value > 0)
|
||||
assumptions.push_back(m_sk.mk_length_limit(kv.m_key, kv.m_value));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue