Skip to content

Commit 24263f8

Browse files
committed
improve expr::leafs to peak through loads
1 parent 332cbac commit 24263f8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

smt/expr.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,14 +2339,24 @@ set<expr> expr::leafs(unsigned max) const {
23392339
if (!seen.emplace(val()).second)
23402340
continue;
23412341

2342-
expr cond, then, els, e;
2342+
expr cond, then, els, e, array, idx;
23432343
unsigned high, low;
23442344
if (val.isIf(cond, then, els)) {
23452345
worklist.emplace_back(std::move(then));
23462346
worklist.emplace_back(std::move(els));
23472347
} else if (val.isExtract(e, high, low) && e.isIf(cond, then, els)) {
23482348
worklist.emplace_back(then.extract(high, low));
23492349
worklist.emplace_back(els.extract(high, low));
2350+
} else if (val.isLoad(array, idx)) {
2351+
if (array.isStore(array, idx, e)) {
2352+
worklist.emplace_back(array.load(idx));
2353+
worklist.emplace_back(std::move(e));
2354+
} else if (array.isIf(cond, then, els)) {
2355+
worklist.emplace_back(then.load(idx));
2356+
worklist.emplace_back(els.load(idx));
2357+
} else {
2358+
ret.emplace(std::move(val));
2359+
}
23502360
} else {
23512361
ret.emplace(std::move(val));
23522362
}

0 commit comments

Comments
 (0)