3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-23 00:37: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:
Copilot 2026-01-14 19:55:31 -08:00 committed by Nikolaj Bjorner
parent 851b8ea31c
commit 317dd92105
475 changed files with 3237 additions and 3237 deletions

View file

@ -38,7 +38,7 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr
expr * numeral = nullptr;
if (is_numeral(args[0])) {
numeral = args[0];
for (unsigned i = 1; i < num_args; i++)
for (unsigned i = 1; i < num_args; ++i)
_args.push_back(args[i]);
num_args--;
}
@ -51,16 +51,16 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr
#define MAX_NUM_ARGS_FOR_OPT 128
// Try to reuse already created circuits.
TRACE(ac_sharing_detail, tout << "args: "; for (unsigned i = 0; i < num_args; i++) tout << mk_pp(_args[i], m) << "\n";);
TRACE(ac_sharing_detail, tout << "args: "; for (unsigned i = 0; i < num_args; ++i) tout << mk_pp(_args[i], m) << "\n";);
try_to_reuse:
if (num_args > 1 && num_args < MAX_NUM_ARGS_FOR_OPT) {
for (unsigned i = 0; i + 1 < num_args; i++) {
for (unsigned j = i + 1; j < num_args; j++) {
for (unsigned i = 0; i + 1 < num_args; ++i) {
for (unsigned j = i + 1; j < num_args; ++j) {
if (contains(f, _args[i], _args[j])) {
TRACE(ac_sharing_detail, tout << "reusing args: " << i << " " << j << "\n";);
_args[i] = m.mk_app(f, _args[i], _args[j]);
SASSERT(num_args > 1);
for (unsigned w = j; w + 1 < num_args; w++) {
for (unsigned w = j; w + 1 < num_args; ++w) {
_args[w] = _args[w+1];
}
num_args--;
@ -75,7 +75,7 @@ br_status maximize_ac_sharing::reduce_app(func_decl * f, unsigned num_args, expr
while (true) {
TRACE(ac_sharing_detail, tout << "tree-loop: num_args: " << num_args << "\n";);
unsigned j = 0;
for (unsigned i = 0; i < num_args; i += 2, j++) {
for (unsigned i = 0; i < num_args; i += 2, ++j) {
if (i == num_args - 1) {
_args[j] = _args[i];
}