File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 20
20
#include " ieee_float.h"
21
21
#include " invariant.h"
22
22
#include " namespace.h"
23
+ #include " pointer_offset_size.h"
23
24
#include " rational.h"
24
25
#include " rational_tools.h"
25
26
#include " std_expr.h"
@@ -1143,6 +1144,30 @@ bool simplify_exprt::simplify_extractbits(extractbits_exprt &expr)
1143
1144
1144
1145
return false ;
1145
1146
}
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
+ }
1146
1171
1147
1172
return true ;
1148
1173
}
You can’t perform that action at this time.
0 commit comments