Skip to content

Commit a86fbea

Browse files
committed
Remove "no-overflow-unary-minus" expressions
1 parent 9b7dd1a commit a86fbea

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

src/solvers/flattening/boolbv.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,8 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
251251
expr.id()==ID_bitxnor || expr.id()==ID_bitnor ||
252252
expr.id()==ID_bitnand)
253253
return convert_bitwise(expr);
254-
else if(expr.id()==ID_unary_minus ||
255-
expr.id()=="no-overflow-unary-minus")
256-
return convert_unary_minus(to_unary_expr(expr));
254+
else if(expr.id() == ID_unary_minus)
255+
return convert_unary_minus(to_unary_minus_expr(expr));
257256
else if(expr.id()==ID_unary_plus)
258257
{
259258
return convert_bitvector(to_unary_plus_expr(expr).op());

src/solvers/flattening/boolbv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class boolbvt:public arrayst
164164
virtual bvt convert_cond(const exprt &expr);
165165
virtual bvt convert_shift(const binary_exprt &expr);
166166
virtual bvt convert_bitwise(const exprt &expr);
167-
virtual bvt convert_unary_minus(const unary_exprt &expr);
167+
virtual bvt convert_unary_minus(const unary_minus_exprt &expr);
168168
virtual bvt convert_abs(const abs_exprt &expr);
169169
virtual bvt convert_concatenation(const exprt &expr);
170170
virtual bvt convert_replication(const replication_exprt &expr);

src/solvers/flattening/boolbv_unary_minus.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Author: Daniel Kroening, [email protected]
1717

1818
#include "boolbv_type.h"
1919

20-
bvt boolbvt::convert_unary_minus(const unary_exprt &expr)
20+
bvt boolbvt::convert_unary_minus(const unary_minus_exprt &expr)
2121
{
2222
const typet &type=ns.follow(expr.type());
2323

@@ -33,8 +33,6 @@ bvt boolbvt::convert_unary_minus(const unary_exprt &expr)
3333
bvtypet bvtype=get_bvtype(type);
3434
bvtypet op_bvtype = get_bvtype(op.type());
3535

36-
bool no_overflow=(expr.id()=="no-overflow-unary-minus");
37-
3836
if(bvtype==bvtypet::IS_UNKNOWN &&
3937
(type.id()==ID_vector || type.id()==ID_complex))
4038
{
@@ -79,27 +77,17 @@ bvt boolbvt::convert_unary_minus(const unary_exprt &expr)
7977
}
8078
else if(bvtype==bvtypet::IS_FIXED && op_bvtype==bvtypet::IS_FIXED)
8179
{
82-
if(no_overflow)
83-
return bv_utils.negate_no_overflow(op_bv);
84-
else
85-
return bv_utils.negate(op_bv);
80+
return bv_utils.negate(op_bv);
8681
}
8782
else if(bvtype==bvtypet::IS_FLOAT && op_bvtype==bvtypet::IS_FLOAT)
8883
{
89-
INVARIANT(!no_overflow, "");
9084
float_utilst float_utils(prop, to_floatbv_type(expr.type()));
9185
return float_utils.negate(op_bv);
9286
}
9387
else if((op_bvtype==bvtypet::IS_SIGNED || op_bvtype==bvtypet::IS_UNSIGNED) &&
9488
(bvtype==bvtypet::IS_SIGNED || bvtype==bvtypet::IS_UNSIGNED))
9589
{
96-
if(no_overflow)
97-
prop.l_set_to(bv_utils.overflow_negate(op_bv), false);
98-
99-
if(no_overflow)
100-
return bv_utils.negate_no_overflow(op_bv);
101-
else
102-
return bv_utils.negate(op_bv);
90+
return bv_utils.negate(op_bv);
10391
}
10492

10593
return conversion_failed(expr);

0 commit comments

Comments
 (0)