Skip to content

Commit 9d8f3f2

Browse files
committed
Use propt::l_set_to_{true,false}
Avoids the lower-level l_set_to(..., {true,false}) and may then highlight opportunities for further optimisation.
1 parent e6a9127 commit 9d8f3f2

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

src/solvers/flattening/boolbv_unary_minus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ bvt boolbvt::convert_unary_minus(const unary_exprt &expr)
104104
(bvtype==bvtypet::IS_SIGNED || bvtype==bvtypet::IS_UNSIGNED))
105105
{
106106
if(no_overflow)
107-
prop.l_set_to(bv_utils.overflow_negate(op_bv), false);
107+
prop.l_set_to_false(bv_utils.overflow_negate(op_bv));
108108

109109
if(no_overflow)
110110
return bv_utils.negate_no_overflow(op_bv);

src/solvers/flattening/bv_pointers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ void bv_pointerst::do_postponed(
739739
if(!is_dynamic)
740740
l2=!l2;
741741

742-
prop.l_set_to(prop.limplies(l1, l2), true);
742+
prop.l_set_to_true(prop.limplies(l1, l2));
743743
}
744744
}
745745
else if(postponed.expr.id()==ID_object_size)
@@ -791,7 +791,7 @@ void bv_pointerst::do_postponed(
791791
bvt size_bv=bv_utils.build_constant(object_size, postponed.bv.size());
792792
literalt l2=bv_utils.equal(postponed.bv, size_bv);
793793

794-
prop.l_set_to(prop.limplies(l1, l2), true);
794+
prop.l_set_to_true(prop.limplies(l1, l2));
795795
}
796796
}
797797
else

src/solvers/flattening/bv_utils.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ bvt bv_utilst::negate(const bvt &bv)
539539

540540
bvt bv_utilst::negate_no_overflow(const bvt &bv)
541541
{
542-
prop.l_set_to(overflow_negate(bv), false);
542+
prop.l_set_to_false(overflow_negate(bv));
543543
return negate(bv);
544544
}
545545

@@ -778,9 +778,7 @@ bvt bv_utilst::absolute_value(const bvt &bv)
778778

779779
bvt bv_utilst::cond_negate_no_overflow(const bvt &bv, literalt cond)
780780
{
781-
prop.l_set_to(
782-
prop.limplies(cond, !overflow_negate(bv)),
783-
true);
781+
prop.l_set_to_true(prop.limplies(cond, !overflow_negate(bv)));
784782

785783
return cond_negate(bv, cond);
786784
}
@@ -800,7 +798,7 @@ bvt bv_utilst::signed_multiplier_no_overflow(
800798

801799
bvt result=unsigned_multiplier_no_overflow(neg0, neg1);
802800

803-
prop.l_set_to(result[result.size()-1], false);
801+
prop.l_set_to_false(result[result.size()-1]);
804802

805803
literalt result_sign=prop.lxor(sign0, sign1);
806804

src/solvers/prop/aig_prop.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ void aig_prop_solvert::convert_aig()
591591

592592
// 3. Do constraints
593593
for(const auto &c_it : aig.constraints)
594-
solver.l_set_to(c_it, true);
594+
solver.l_set_to_true(c_it);
595595

596596
// HACK!
597597
aig.nodes.clear();

src/solvers/prop/aig_prop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class aig_prop_baset:public propt
4141
literalt lselect(literalt a, literalt b, literalt c) override; // a?b:c
4242
void set_equal(literalt a, literalt b) override;
4343

44-
void l_set_to(literalt a, bool value) override { assert(false); }
44+
void l_set_to(literalt a, bool value) override = 0;
4545

4646
literalt new_variable() override
4747
{

0 commit comments

Comments
 (0)