Skip to content

Commit 7641c46

Browse files
authored
Merge pull request #8005 from tautschnig/fixup-simp
Restore post-order simplification of byte_extract(c ? a : b, ...)
2 parents 31207f8 + 56d171a commit 7641c46

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/util/simplify_expr.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,17 @@ simplify_exprt::resultt<> simplify_exprt::simplify_object(const exprt &expr)
16491649
simplify_exprt::resultt<>
16501650
simplify_exprt::simplify_byte_extract(const byte_extract_exprt &expr)
16511651
{
1652+
// lift up any ID_if on the object
1653+
if(expr.op().id() == ID_if)
1654+
{
1655+
if_exprt if_expr = lift_if(expr, 0);
1656+
if_expr.true_case() =
1657+
simplify_byte_extract(to_byte_extract_expr(if_expr.true_case()));
1658+
if_expr.false_case() =
1659+
simplify_byte_extract(to_byte_extract_expr(if_expr.false_case()));
1660+
return changed(simplify_if(if_expr));
1661+
}
1662+
16521663
const auto el_size = pointer_offset_bits(expr.type(), ns);
16531664
if(el_size.has_value() && *el_size < 0)
16541665
return unchanged(expr);

0 commit comments

Comments
 (0)