@@ -1903,11 +1903,12 @@ expr Memory::int2ptr(const expr &val) const {
19031903 return expr::mkIf (val == 0 , null, fn);
19041904}
19051905
1906- expr Memory::blockValRefined (const Memory &other, unsigned bid, bool local,
1906+ expr Memory::blockValRefined (const Memory &other, unsigned bid,
1907+ optional<unsigned > bid_other,
19071908 const expr &offset, set<expr> &undef) const {
1908- assert (!local) ;
1909- auto &mem1 = non_local_block_val[bid];
1910- auto &mem2 = other.non_local_block_val [bid].val ;
1909+ auto &mem1 = (bid_other ? local_block_val : non_local_block_val)[bid] ;
1910+ auto &mem2 = bid_other ? other. local_block_val [*bid_other]. val :
1911+ other.non_local_block_val [bid].val ;
19111912
19121913 if (mem1.val .eq (mem2))
19131914 return true ;
@@ -1938,7 +1939,23 @@ expr Memory::blockValRefined(const Memory &other, unsigned bid, bool local,
19381939 return val.refined (val2);
19391940}
19401941
1942+ expr Memory::blockPropertiesRefined (const Pointer &src, const Pointer &tgt)
1943+ const {
1944+ expr aligned (true );
1945+ expr src_align = src.blockAlignment ();
1946+ expr tgt_align = tgt.blockAlignment ();
1947+ // if they are both non-const, then the condition holds per the precondition
1948+ if (src_align.isConst () || tgt_align.isConst ())
1949+ aligned = src_align.ule (tgt_align);
1950+
1951+ return src.isBlockAlive () == tgt.isBlockAlive () &&
1952+ src.blockSize () == tgt.blockSize () &&
1953+ src.getAllocType () == tgt.getAllocType () &&
1954+ aligned;
1955+ }
1956+
19411957expr Memory::blockRefined (const Pointer &src, const Pointer &tgt, unsigned bid,
1958+ optional<unsigned > bid_other,
19421959 set<expr> &undef) const {
19431960 unsigned bytes_per_byte = bits_byte / 8 ;
19441961
@@ -1953,29 +1970,18 @@ expr Memory::blockRefined(const Pointer &src, const Pointer &tgt, unsigned bid,
19531970 expr off_expr = expr::mkUInt (off, Pointer::bitsShortOffset ());
19541971 val_refines
19551972 &= (ptr_offset == off_expr).implies (
1956- blockValRefined (tgt.getMemory (), bid, false , off_expr, undef));
1973+ blockValRefined (tgt.getMemory (), bid, bid_other , off_expr, undef));
19571974 }
19581975 } else {
19591976 val_refines
19601977 = src.getOffsetSizet ().ult (src.blockSizeOffsetT ()).implies (
1961- blockValRefined (tgt.getMemory (), bid, false , ptr_offset, undef));
1978+ blockValRefined (tgt.getMemory (), bid, bid_other , ptr_offset, undef));
19621979 }
19631980
19641981 assert (src.isWritable ().eq (tgt.isWritable ()));
19651982
1966- expr aligned (true );
1967- expr src_align = src.blockAlignment ();
1968- expr tgt_align = tgt.blockAlignment ();
1969- // if they are both non-const, then the condition holds per the precondition
1970- if (src_align.isConst () || tgt_align.isConst ())
1971- aligned = src_align.ule (tgt_align);
1972-
19731983 expr alive = src.isBlockAlive ();
1974- return alive == tgt.isBlockAlive () &&
1975- blk_size == tgt.blockSize () &&
1976- src.getAllocType () == tgt.getAllocType () &&
1977- aligned &&
1978- alive.implies (val_refines);
1984+ return blockPropertiesRefined (src, tgt) && alive.implies (val_refines);
19791985}
19801986
19811987tuple<expr, Pointer, set<expr>>
@@ -2027,7 +2033,8 @@ Memory::refined(const Memory &other, bool fncall,
20272033 Pointer q (other, p ());
20282034 if (p.isByval ().isTrue () && q.isByval ().isTrue ())
20292035 continue ;
2030- ret &= (ptr_bid == bid_expr).implies (blockRefined (p, q, bid, undef_vars));
2036+ ret &= (ptr_bid == bid_expr)
2037+ .implies (blockRefined (p, q, bid, nullopt , undef_vars));
20312038 }
20322039
20332040 // restrict refinement check to set of request blocks
0 commit comments