mirror of
https://github.com/Z3Prover/z3
synced 2026-06-11 03:15:36 +00:00
Standardize for-loop increments to prefix form (++i) (#8199)
* Initial plan * Convert postfix to prefix increment in for loops Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Fix member variable increment conversion bug Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> * Update API generator to produce prefix increments Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
1bf463d77a
commit
2436943794
475 changed files with 3237 additions and 3237 deletions
|
|
@ -200,7 +200,7 @@ expr_ref demodulator_rewriter_util::rewrite(expr * n) {
|
|||
m_rewrite_todo.push_back(n);
|
||||
while (!m_rewrite_todo.empty()) {
|
||||
TRACE(demodulator_stack, tout << "STACK: " << std::endl;
|
||||
for (unsigned i = 0; i < m_rewrite_todo.size(); i++)
|
||||
for (unsigned i = 0; i < m_rewrite_todo.size(); ++i)
|
||||
tout << std::dec << i << ": " << std::hex << (size_t)m_rewrite_todo[i] <<
|
||||
" = " << mk_pp(m_rewrite_todo[i], m) << std::endl;
|
||||
);
|
||||
|
|
@ -495,7 +495,7 @@ expr * demodulator_rewriter::rewrite(expr * n) {
|
|||
m_rewrite_todo.push_back(n);
|
||||
while (!m_rewrite_todo.empty()) {
|
||||
TRACE(demodulator_stack, tout << "STACK: " << std::endl;
|
||||
for (unsigned i = 0; i < m_rewrite_todo.size(); i++)
|
||||
for (unsigned i = 0; i < m_rewrite_todo.size(); ++i)
|
||||
tout << std::dec << i << ": " << std::hex << (size_t)m_rewrite_todo[i] <<
|
||||
" = " << mk_pp(m_rewrite_todo[i], m) << std::endl;
|
||||
);
|
||||
|
|
@ -879,7 +879,7 @@ bool demodulator_match_subst::match_args(app * lhs, expr * const * args) {
|
|||
m_all_args_eq = true;
|
||||
unsigned num_args = lhs->get_num_args();
|
||||
if (!fill_commutative(lhs, args)) {
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
for (unsigned i = 0; i < num_args; ++i) {
|
||||
expr * t_arg = lhs->get_arg(i);
|
||||
expr * i_arg = args[i];
|
||||
if (t_arg != i_arg)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void substitution::reset() {
|
|||
|
||||
void substitution::reset_cache() {
|
||||
TRACE(subst_bug, tout << "substitution::reset_cache\n";
|
||||
for (unsigned i = 0; i < m_new_exprs.size(); i++) { tout << mk_pp(m_new_exprs.get(i), m_manager) << "\nref_count: " << m_new_exprs.get(i)->get_ref_count() << "\n"; });
|
||||
for (unsigned i = 0; i < m_new_exprs.size(); ++i) { tout << mk_pp(m_new_exprs.get(i), m_manager) << "\nref_count: " << m_new_exprs.get(i)->get_ref_count() << "\n"; });
|
||||
|
||||
m_apply_cache.reset();
|
||||
m_new_exprs.reset();
|
||||
|
|
@ -54,7 +54,7 @@ void substitution::pop_scope(unsigned num_scopes) {
|
|||
unsigned old_sz = m_scopes[new_lvl];
|
||||
unsigned curr_sz = m_vars.size();
|
||||
SASSERT(old_sz <= curr_sz);
|
||||
for (unsigned i = old_sz; i < curr_sz; i++) {
|
||||
for (unsigned i = old_sz; i < curr_sz; ++i) {
|
||||
var_offset & curr = m_vars[i];
|
||||
m_subst.erase(curr.first, curr.second);
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e
|
|||
m_todo.pop_back();
|
||||
new_args.reset();
|
||||
bool has_new_args = false;
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
for (unsigned i = 0; i < num_args; ++i) {
|
||||
expr * arg = to_app(e)->get_arg(i);
|
||||
expr * new_arg = nullptr;
|
||||
|
||||
|
|
@ -175,8 +175,8 @@ void substitution::apply(unsigned num_actual_offsets, unsigned const * deltas, e
|
|||
subst.reserve(m_subst.offsets_capacity(), m_subst.vars_capacity() + num_vars);
|
||||
var_shifter var_sh(m_manager);
|
||||
expr_offset r;
|
||||
for (unsigned i = 0; i < m_subst.offsets_capacity(); i++) {
|
||||
for (unsigned j = 0; j < m_subst.vars_capacity(); j++) {
|
||||
for (unsigned i = 0; i < m_subst.offsets_capacity(); ++i) {
|
||||
for (unsigned j = 0; j < m_subst.vars_capacity(); ++j) {
|
||||
if (find(j, i, r)) {
|
||||
var_sh(r.get_expr(), num_vars, er);
|
||||
subst.insert(j + num_vars, i, expr_offset(er, r.get_offset()));
|
||||
|
|
@ -311,8 +311,8 @@ bool substitution::acyclic() {
|
|||
|
||||
void substitution::display(std::ostream & out, unsigned num_actual_offsets, unsigned const * deltas) {
|
||||
reset_cache();
|
||||
for (unsigned i = 0; i < num_actual_offsets; i++)
|
||||
for (unsigned j = 0; j < m_subst.vars_capacity(); j++) {
|
||||
for (unsigned i = 0; i < num_actual_offsets; ++i)
|
||||
for (unsigned j = 0; j < m_subst.vars_capacity(); ++j) {
|
||||
expr_offset r;
|
||||
if (find(j, i, r)) {
|
||||
expr_ref tmp(m_manager);
|
||||
|
|
@ -323,8 +323,8 @@ void substitution::display(std::ostream & out, unsigned num_actual_offsets, unsi
|
|||
}
|
||||
|
||||
void substitution::display(std::ostream & out) {
|
||||
for (unsigned i = 0; i < m_subst.offsets_capacity(); i++)
|
||||
for (unsigned j = 0; j < m_subst.vars_capacity(); j++) {
|
||||
for (unsigned i = 0; i < m_subst.offsets_capacity(); ++i)
|
||||
for (unsigned j = 0; j < m_subst.vars_capacity(); ++j) {
|
||||
expr_offset r;
|
||||
if (find(j, i, r))
|
||||
out << "VAR " << j << ":" << i << " --> " << r.get_offset() << "\n" << mk_pp(r.get_expr(), m_manager) << "\n";
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ inline void substitution_tree::erase_reg_from_todo(unsigned ridx) {
|
|||
*/
|
||||
void substitution_tree::linearize(svector<subst> & result) {
|
||||
ptr_buffer<expr> new_args;
|
||||
for (unsigned i = 0; i < m_todo.size(); i++) {
|
||||
for (unsigned i = 0; i < m_todo.size(); ++i) {
|
||||
unsigned ireg_idx = m_todo[i];
|
||||
expr * n = get_reg_value(ireg_idx);
|
||||
var * ireg = m_manager.mk_var(ireg_idx, n->get_sort());
|
||||
|
|
@ -83,7 +83,7 @@ void substitution_tree::linearize(svector<subst> & result) {
|
|||
if (num == 0)
|
||||
new_app = to_app(n);
|
||||
else {
|
||||
for (unsigned j = 0; j < num; j++) {
|
||||
for (unsigned j = 0; j < num; ++j) {
|
||||
unsigned oreg = next_reg();
|
||||
set_reg_value(oreg, to_app(n)->get_arg(j));
|
||||
m_todo.push_back(oreg);
|
||||
|
|
@ -109,7 +109,7 @@ void substitution_tree::process_args(app * in, app * out) {
|
|||
CTRACE(subst_tree_bug, in->get_num_args() != out->get_num_args(), tout << mk_ismt2_pp(in, m_manager) << "\n"
|
||||
<< mk_ismt2_pp(out, m_manager) << "\n";);
|
||||
unsigned num = out->get_num_args();
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
for (unsigned i = 0; i < num; ++i) {
|
||||
expr * in_arg = in->get_arg(i);
|
||||
expr * out_arg = out->get_arg(i);
|
||||
SASSERT(is_var(out_arg));
|
||||
|
|
@ -232,7 +232,7 @@ void substitution_tree::mark_used_regs(svector<subst> const & sv) {
|
|||
mark_used_reg(s.first->get_idx());
|
||||
if (is_app(s.second)) {
|
||||
unsigned num_args = to_app(s.second)->get_num_args();
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
for (unsigned i = 0; i < num_args; ++i) {
|
||||
expr * arg = to_app(s.second)->get_arg(i);
|
||||
SASSERT(is_var(arg));
|
||||
mark_used_reg(to_var(arg)->get_idx());
|
||||
|
|
@ -578,7 +578,7 @@ void substitution_tree::display(std::ostream & out, subst const & s) const {
|
|||
out << to_app(s.second)->get_decl()->get_name();
|
||||
else {
|
||||
out << "(" << to_app(s.second)->get_decl()->get_name();
|
||||
for (unsigned i = 0; i < num; i++)
|
||||
for (unsigned i = 0; i < num; ++i)
|
||||
out << " r!" << to_var(to_app(s.second)->get_arg(i))->get_idx();
|
||||
out << ")";
|
||||
}
|
||||
|
|
@ -600,7 +600,7 @@ void substitution_tree::display(std::ostream & out, svector<subst> const & sv) c
|
|||
}
|
||||
|
||||
void substitution_tree::display(std::ostream & out, node * n, unsigned delta) const {
|
||||
for (unsigned i = 0; i < delta; i++)
|
||||
for (unsigned i = 0; i < delta; ++i)
|
||||
out << " ";
|
||||
display(out, n->m_subst);
|
||||
if (n->m_leaf) {
|
||||
|
|
@ -734,7 +734,7 @@ bool substitution_tree::visit_vars(expr * e, st_visitor & st) {
|
|||
var_ref_vector * v = m_vars[s_id];
|
||||
if (v && !v->empty()) {
|
||||
unsigned sz = v->size();
|
||||
for (unsigned i = 0; i < sz; i++) {
|
||||
for (unsigned i = 0; i < sz; ++i) {
|
||||
var * curr = v->get(i);
|
||||
m_subst->push_scope();
|
||||
if (unify_match<Mode>(expr_offset(curr, m_st_offset), expr_offset(e, m_in_offset))) {
|
||||
|
|
@ -870,7 +870,7 @@ void substitution_tree::display(std::ostream & out) const {
|
|||
if (v == nullptr)
|
||||
continue; // m_vars may contain null pointers. See substitution_tree::insert.
|
||||
unsigned num = v->size();
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
for (unsigned i = 0; i < num; ++i) {
|
||||
if (!found_var) {
|
||||
found_var = true;
|
||||
out << "vars: ";
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ bool unifier::operator()(unsigned num_exprs, expr ** es, substitution & s, bool
|
|||
}
|
||||
}
|
||||
#endif
|
||||
for (unsigned i = 0; i < num_exprs - 1; i++) {
|
||||
for (unsigned i = 0; i < num_exprs - 1; ++i) {
|
||||
if (!unify_core(expr_offset(es[i], use_offsets ? i : 0),
|
||||
expr_offset(es[i+1], use_offsets ? i + 1 : 0))) {
|
||||
m_last_call_succeeded = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue