mirror of
https://github.com/Z3Prover/z3
synced 2025-08-20 02:00:22 +00:00
add bv-size reduce #6137
- add option smt.bv.reduce_size. - it allows to apply incremental pre-processing of bit-vectors by identifying ranges that are known to be constant. This rewrite is beneficial, for instance, when bit-vectors are constrained to have many high-level bits set to 0.
This commit is contained in:
parent
45a4b810de
commit
48b13291d1
8 changed files with 78 additions and 0 deletions
|
@ -190,3 +190,17 @@ void expr_safe_replace::apply_substitution(expr* s, expr* def, expr_ref& t) {
|
|||
(*this)(t, t);
|
||||
reset();
|
||||
}
|
||||
|
||||
void expr_safe_replace::push_scope() {
|
||||
m_limit.push_back(m_src.size());
|
||||
}
|
||||
|
||||
void expr_safe_replace::pop_scope(unsigned n) {
|
||||
unsigned old_sz = m_limit[m_limit.size() - n];
|
||||
if (old_sz != m_src.size()) {
|
||||
m_cache.clear();
|
||||
m_src.shrink(old_sz);
|
||||
m_dst.shrink(old_sz);
|
||||
}
|
||||
m_limit.shrink(m_limit.size() - n);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ class expr_safe_replace {
|
|||
ast_manager& m;
|
||||
expr_ref_vector m_src;
|
||||
expr_ref_vector m_dst;
|
||||
unsigned_vector m_limit = 0;
|
||||
ptr_vector<expr> m_todo, m_args;
|
||||
expr_ref_vector m_refs;
|
||||
std::unordered_map<expr*,expr*> m_cache;
|
||||
|
@ -48,5 +49,9 @@ public:
|
|||
void reset();
|
||||
|
||||
bool empty() const { return m_src.empty(); }
|
||||
|
||||
void push_scope();
|
||||
|
||||
void pop_scope(unsigned n);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue