File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1147,6 +1147,32 @@ bool simplify_exprt::simplify_extractbits(extractbits_exprt &expr)
1147
1147
1148
1148
return false ;
1149
1149
}
1150
+ else if (expr.src ().id () == ID_concatenation)
1151
+ {
1152
+ // the most-significant bit comes first in an concatenation_exprt, hence we
1153
+ // count down
1154
+ mp_integer offset = width;
1155
+
1156
+ forall_operands (it, expr.src ())
1157
+ {
1158
+ mp_integer op_width = pointer_offset_bits (it->type (), ns);
1159
+
1160
+ if (op_width <= 0 )
1161
+ return true ;
1162
+
1163
+ if (start + 1 == offset && end + op_width == offset)
1164
+ {
1165
+ exprt tmp = *it;
1166
+ if (tmp.type () != expr.type ())
1167
+ return true ;
1168
+
1169
+ expr.swap (tmp);
1170
+ return false ;
1171
+ }
1172
+
1173
+ offset -= op_width;
1174
+ }
1175
+ }
1150
1176
1151
1177
return true ;
1152
1178
}
You can’t perform that action at this time.
0 commit comments