fix prev commit to check refinement of inaccessible blocks on final check
not on fncall mem refinement (doesnt make sense; it's inaccessible)
MODIFY
ir/memory.cpp
ir/memory.cpp
@@ -1955,7 +1955,7 @@ expr Memory::blockRefined(const Pointer &src, const Pointer &tgt, unsigned bid,
}
tuple<expr, Pointer, set<expr>>
-Memory::refined(const Memory &other, bool skip_constants,
+Memory::refined(const Memory &other, bool fncall,
const vector<PtrInput> *set_ptrs,
const vector<PtrInput> *set_ptrs2) const {
if (num_nonlocals <= has_null_block)
@@ -1968,9 +1968,6 @@ Memory::refined(const Memory &other, bool skip_constants,
expr ret(true);
set<expr> undef_vars;
- unsigned max_prog_bids
- = num_nonlocals_src - num_inaccessiblememonly_fns - has_write_fncall;
-
AliasSet block_alias(other);
for (auto &[mem, set]
: { make_pair(this, set_ptrs), make_pair(&other, set_ptrs2)}) {
@@ -1983,14 +1980,19 @@ Memory::refined(const Memory &other, bool skip_constants,
if (mem->next_nonlocal_bid > 0)
block_alias.setMayAliasUpTo(false, mem->next_nonlocal_bid-1);
- // Check all fn calls blocks
- for (unsigned bid = max_prog_bids; bid < num_nonlocals_src; ++bid) {
+ if (has_write_fncall)
+ block_alias.setMayAlias(false, get_fncallmem_bid());
+
+ if (!fncall) {
+ for (unsigned bid = num_nonlocals_src - num_inaccessiblememonly_fns;
+ bid < num_nonlocals_src; ++bid) {
block_alias.setMayAlias(false, bid);
}
}
}
+ }
- unsigned bid = has_null_block + skip_constants * num_consts_src;
+ unsigned bid = has_null_block + fncall * num_consts_src;
for (; bid < num_nonlocals_src; ++bid) {
if (!block_alias.mayAlias(false, bid))
continue;

fix prev commit to check refinement of inaccessible blocks on final check
not on fncall mem refinement (doesnt make sense; it's inaccessible)