Skip to content

Commit

Permalink
skip update stack items that are not Bool/bv
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Jan 28, 2025
1 parent 632e2b5 commit 2ebc647
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/ast/sls/sls_bv_lookahead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,15 @@ namespace sls {

void bv_lookahead::populate_update_stack(expr* t) {
SASSERT(m_bv_restore.empty());
insert_update_stack(t);
if (!insert_update_stack(t))
return;
m_min_depth = m_max_depth = get_depth(t);
for (unsigned depth = m_max_depth; depth <= m_max_depth; ++depth) {
for (unsigned i = 0; i < m_update_stack[depth].size(); ++i) {
auto [a, is_bv] = m_update_stack[depth][i];
for (auto p : ctx.parents(a)) {
insert_update_stack(p);
m_max_depth = std::max(m_max_depth, get_depth(p));
if (insert_update_stack(p))
m_max_depth = std::max(m_max_depth, get_depth(p));
}
if (is_bv) {
wval(a).save_value();
Expand Down Expand Up @@ -581,7 +582,7 @@ namespace sls {
try_flip(u);
clear_update_stack();
return;
}
}
SASSERT(bv.is_bv(u));
auto& v = wval(u);
while (m_v_saved.size() < v.bits().size()) {
Expand Down Expand Up @@ -669,7 +670,7 @@ namespace sls {
}
}

insert_update_stack(t);
VERIFY(insert_update_stack(t));
unsigned max_depth = get_depth(t);
unsigned restore_point = m_ev.bool_value_restore_point();
for (unsigned depth = max_depth; depth <= max_depth; ++depth) {
Expand Down Expand Up @@ -719,8 +720,8 @@ namespace sls {
}

for (auto p : ctx.parents(e)) {
insert_update_stack(p);
max_depth = std::max(max_depth, get_depth(p));
if (insert_update_stack(p))
max_depth = std::max(max_depth, get_depth(p));
}

if (is_root(e)) {
Expand Down Expand Up @@ -764,15 +765,16 @@ namespace sls {
}
}

void bv_lookahead::insert_update_stack(expr* e) {
bool bv_lookahead::insert_update_stack(expr* e) {
if (!bv.is_bv(e) && !m.is_bool(e))
return;
return false;
unsigned depth = get_depth(e);
m_update_stack.reserve(depth + 1);
if (!m_in_update_stack.is_marked(e) && is_app(e)) {
m_in_update_stack.mark(e);
m_update_stack[depth].push_back({ to_app(e), bv.is_bv(e) });
}
return true;
}

sls::bv_valuation& bv_lookahead::wval(expr* e) const {
Expand Down

0 comments on commit 2ebc647

Please sign in to comment.