@@ -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