@@ -474,7 +474,6 @@ static StateValue bytesToValue(const Memory &m, const vector<Byte> &bytes,
474474 // A zero integer byte is considered as a null pointer byte with any byte
475475 // offset.
476476 expr non_poison = true ;
477- AndExpr ptr_constrs, non_ptr_constrs;
478477
479478 for (unsigned i = 0 , e = bytes.size (); i < e; ++i) {
480479 auto &b = bytes[i];
@@ -487,13 +486,12 @@ static StateValue bytesToValue(const Memory &m, const vector<Byte> &bytes,
487486 } else {
488487 non_poison &= is_ptr == b_is_ptr;
489488 }
490- ptr_constrs. add (b. ptrByteoffset () == i);
491- ptr_constrs. add (ptr_value == loaded_ptr);
492- non_ptr_constrs. add (b. nonptrValue () == 0 );
493-
489+ non_poison &=
490+ expr::mkIf (is_ptr,
491+ b. ptrByteoffset () == i && ptr_value == loaded_ptr,
492+ b. nonptrValue () == 0 );
494493 non_poison &= !b.isPoison ();
495494 }
496- non_poison &= expr::mkIf (is_ptr, ptr_constrs (), non_ptr_constrs ());
497495
498496 // if bits of loaded ptr are a subset of the non-ptr value,
499497 // we know they must be zero otherwise the value is poison.
@@ -1775,7 +1773,6 @@ StateValue Memory::load(const Pointer &ptr, const Type &type, set<expr> &undef,
17751773 // partial order reduction for fresh pointers
17761774 // can alias [0, next_ptr++] U extra_tgt_consts
17771775 if (is_ptr && !val.non_poison .isFalse ()) {
1778- AndExpr constr;
17791776 optional<unsigned > max_bid;
17801777 for (auto &p : all_leaf_ptrs (*this , val.value )) {
17811778 auto islocal = p.isLocal ();
@@ -1789,15 +1786,10 @@ StateValue Memory::load(const Pointer &ptr, const Type &type, set<expr> &undef,
17891786 for (unsigned i = num_nonlocals_src; i < numNonlocals (); ++i) {
17901787 I->second .setMayAlias (false , i);
17911788 }
1792-
1793- expr c = islocal || bid.ule (*max_bid);
1794- if (numNonlocals () > num_nonlocals_src)
1795- c |= bid.uge (num_nonlocals_src) && bid.ule (numNonlocals ()-1 );
1796- constr.add (std::move (c));
1789+ state->addPre (!val.non_poison || islocal || bid.ule (*max_bid));
17971790 }
17981791 }
17991792 }
1800- state->addPre (val.non_poison .implies (constr ()));
18011793 }
18021794
18031795 return val;
0 commit comments