Skip to content

Commit

Permalink
smt expr: check memory threshold before rewriting a lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Dec 16, 2024
1 parent 57056bd commit 84196ac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion smt/expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "smt/expr.h"
#include "smt/exprs.h"
#include "smt/ctx.h"
#include "smt/smt.h"
#include "util/compiler.h"
#include <algorithm>
#include <bit>
Expand Down Expand Up @@ -61,6 +62,9 @@ static expr simplify_const(expr &&e, const expr &input,
}

static bool is_power2(const expr &e, unsigned &log) {
if (!e.isConst())
return false;

if (e.isZero() || !(e & (e - expr::mkUInt(1, e))).isZero())
return false;

Expand Down Expand Up @@ -2071,7 +2075,7 @@ expr expr::load(const expr &idx, uint64_t max_idx) const {

} else if (isConstArray(val)) {
return val;
} else if (isLambda(val)) {
} else if (isLambda(val) && !hit_half_memory_limit()) {
return val.subst({ idx }).foldTopLevel();
}

Expand Down

0 comments on commit 84196ac

Please sign in to comment.