Skip to content

Commit 14c00dc

Browse files
committed
Simplify all expressions generated by flatten_byte_operators
We construct several non-trivial expressions that, e.g., contain sums over constants. As these expressions may be passed to array post-processing (flatten_byte_operators is in particular used with unbounded arrays) this can have a significant impact on the size of array index sets.
1 parent 71e9642 commit 14c00dc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/solvers/flattening/flatten_byte_operators.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,12 @@ exprt flatten_byte_extract(
242242

243243
byte_extract_exprt tmp(unpacked);
244244
tmp.type()=subtype;
245-
tmp.offset()=simplify_expr(new_offset, ns);
245+
tmp.offset()=new_offset;
246246

247247
array.copy_to_operands(flatten_byte_extract(tmp, ns));
248248
}
249249

250-
return array;
250+
return simplify_expr(array, ns);
251251
}
252252
}
253253
else if(type.id()==ID_struct)
@@ -277,13 +277,13 @@ exprt flatten_byte_extract(
277277

278278
byte_extract_exprt tmp(unpacked);
279279
tmp.type()=comp.type();
280-
tmp.offset()=simplify_expr(new_offset, ns);
280+
tmp.offset()=new_offset;
281281

282282
s.move_to_operands(tmp);
283283
}
284284

285285
if(!failed)
286-
return s;
286+
return simplify_expr(s, ns);
287287
}
288288

289289
const exprt &root=unpacked.op();
@@ -333,7 +333,7 @@ exprt flatten_byte_extract(
333333
{
334334
concatenation_exprt concatenation(src.type());
335335
concatenation.operands().swap(op);
336-
return concatenation;
336+
return simplify_expr(concatenation, ns);
337337
}
338338
}
339339

@@ -413,7 +413,7 @@ exprt flatten_byte_update(
413413
result.swap(with_expr);
414414
}
415415

416-
return result;
416+
return simplify_expr(result, ns);
417417
}
418418
else // sub_size!=1
419419
{
@@ -512,7 +512,7 @@ exprt flatten_byte_update(
512512
result=with_expr;
513513
}
514514

515-
return result;
515+
return simplify_expr(result, ns);
516516
}
517517
}
518518
else
@@ -583,7 +583,7 @@ exprt flatten_byte_update(
583583
// original_bits |= newvalue
584584
bitor_exprt bitor_expr(bitand_expr, value_shifted);
585585

586-
return bitor_expr;
586+
return simplify_expr(bitor_expr, ns);
587587
}
588588
else
589589
{

0 commit comments

Comments
 (0)