Skip to content

simplify: rewrite bitxnor on booleans to equal #8594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/util/simplify_expr_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@
new_expr.id(ID_or);
else if(expr.id()==ID_bitxor)
new_expr.id(ID_xor);
else if(expr.id() == ID_bitxnor)
new_expr.id(ID_equal);

Check warning on line 700 in src/util/simplify_expr_int.cpp

View check run for this annotation

Codecov / codecov/patch

src/util/simplify_expr_int.cpp#L699-L700

Added lines #L699 - L700 were not covered by tests
Comment on lines +699 to +700
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below we call simplify_boolean on the resulting expression, which won't know how to simplify equality. We'll have to change the call below to simplify_node.

else
UNREACHABLE;

Expand All @@ -709,8 +711,8 @@
*it=true_exprt();
}

new_expr.type()=bool_typet();
new_expr = simplify_boolean(new_expr);
new_expr.type() = bool_typet{};
new_expr = simplify_node(new_expr);

return changed(simplify_typecast(typecast_exprt(new_expr, expr.type())));
}
Expand Down
Loading