File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ Author: Daniel Kroening, kroening@kroening.com
2020#include " ieee_float.h"
2121#include " invariant.h"
2222#include " namespace.h"
23+ #include " pointer_offset_size.h"
2324#include " rational.h"
2425#include " rational_tools.h"
2526#include " std_expr.h"
@@ -1143,6 +1144,30 @@ bool simplify_exprt::simplify_extractbits(extractbits_exprt &expr)
11431144
11441145 return false ;
11451146 }
1147+ else if (expr.src ().id () == ID_concatenation)
1148+ {
1149+ mp_integer offset = width;
1150+
1151+ forall_operands (it, expr.src ())
1152+ {
1153+ mp_integer op_width = pointer_offset_bits (it->type (), ns);
1154+
1155+ if (op_width <= 0 )
1156+ return true ;
1157+
1158+ if (start + 1 == offset && end + op_width == offset)
1159+ {
1160+ exprt tmp = *it;
1161+ if (tmp.type () != expr.type ())
1162+ tmp.make_typecast (expr.type ());
1163+ expr.swap (tmp);
1164+
1165+ return false ;
1166+ }
1167+
1168+ offset -= op_width;
1169+ }
1170+ }
11461171
11471172 return true ;
11481173}
You can’t perform that action at this time.
0 commit comments