MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / mayalias

Method mayalias

ir/memory.cpp:939–1001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937}
938
939bool Memory::mayalias(bool local, unsigned bid0, const expr &offset0,
940 const expr &bytes, uint64_t align, bool write) const {
941 if (local && bid0 >= next_local_bid)
942 return false;
943
944 if (!local) {
945 if (bid0 >= numNonlocals()) return false;
946 if (!write && always_noread(bid0)) return false;
947 if ( write && always_nowrite(bid0)) return false;
948 }
949
950 if (state->isUndef(offset0))
951 return false;
952
953 expr bid = expr::mkUInt(bid0, Pointer::bitsShortBid());
954
955 if (auto sz = (local ? local_blk_size : non_local_blk_size).lookup(bid)) {
956 if (sz->ult(bytes).isTrue())
957 return false;
958
959 //expr offset = offset0.sextOrTrunc(bits_size_t);
960
961#if 0
962 // Never hits in practice
963 // FIXME: this is for logical pointers
964 if (auto blk_align0
965 = (local ? local_blk_align : non_local_blk_align).lookup(bid)) {
966 int64_t off;
967 uint64_t blk_align;
968 if (offset0.isInt(off) && off > 0 &&
969 blk_align0->isUInt(blk_align) &&
970 ((uint64_t)off % align) % (1ull << blk_align) != 0)
971 return false;
972 }
973#endif
974
975 if (local && !observed_addrs.mayAlias(true, bid0)) {
976 // block align must be >= access align if the address hasn't been observed
977 if (auto blk_align0 = local_blk_align.lookup(bid)) {
978 uint64_t blk_align;
979 if (blk_align0->isUInt(blk_align) &&
980 (1ull << blk_align) < align)
981 return false;
982 }
983 }
984
985#if 0
986 // Never hits in practice
987 // FIXME: this is for logical pointers
988 if (!isAsmMode()) {
989 if (offset.uge(*sz).isTrue() ||
990 (*sz - offset).ult(bytes).isTrue())
991 return false;
992 }
993#endif
994 } else if (local) // allocated in another branch
995 return false;
996

Callers

nothing calls this directly

Calls 11

always_noreadFunction · 0.85
always_nowriteFunction · 0.85
isUndefMethod · 0.80
ultMethod · 0.80
isUIntMethod · 0.80
mayAliasMethod · 0.80
ugeMethod · 0.80
isFalseMethod · 0.80
lookupMethod · 0.45
isTrueMethod · 0.45
isIntMethod · 0.45

Tested by

no test coverage detected