3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-19 17:50:23 +00:00

#6100 - two perf fixes

remaining perf bug is dealing with very large bit-widths. mod 2^n should be computed natively based on n instead of 2^n because we pre-populate an array with all values up to n. Suppose n is 10000, the array has size 10000.
This commit is contained in:
Nikolaj Bjorner 2022-06-21 12:45:29 -07:00
parent f24c5ca99a
commit 202ce1edf0
2 changed files with 16 additions and 4 deletions

View file

@ -23,6 +23,7 @@ Notes:
#include "ast/ast_ll_pp.h"
#include "ast/rewriter/var_subst.h"
#include "params/array_rewriter_params.hpp"
#include "util/util.h"
void array_rewriter::updt_params(params_ref const & _p) {
array_rewriter_params p(_p);
@ -161,7 +162,8 @@ br_status array_rewriter::mk_store_core(unsigned num_args, expr * const * args,
return BR_FAILED;
}
br_status array_rewriter::mk_select_core(unsigned num_args, expr * const * args, expr_ref & result) {
SASSERT(num_args >= 2);
if (m_util.is_store(args[0])) {
@ -172,9 +174,16 @@ br_status array_rewriter::mk_select_core(unsigned num_args, expr * const * args,
result = to_app(args[0])->get_arg(num_args);
return BR_DONE;
case l_false: {
expr* arg0 = args[0];
expr* arg1 = to_app(arg0)->get_arg(0);
while (m_util.is_store(arg1) && compare_args<true>(num_args-1, args + 1, to_app(arg0)->get_args() + 1) == l_false) {
arg0 = arg1;
arg1 = to_app(arg0)->get_arg(0);
}
// select(store(a, I, v), J) --> select(a, J) if I != J
ptr_buffer<expr> new_args;
new_args.push_back(to_app(args[0])->get_arg(0));
new_args.push_back(arg1);
new_args.append(num_args-1, args+1);
result = m().mk_app(get_fid(), OP_SELECT, num_args, new_args.data());
return BR_REWRITE1;