diff options
author | Andres Notzli <andres.noetzli@gmail.com> | 2016-12-08 14:21:28 -0800 |
---|---|---|
committer | Andres Notzli <andres.noetzli@gmail.com> | 2016-12-08 20:12:53 -0800 |
commit | 762c8a3cf028fa7c12c2ee32d8643bd73ff2f07c (patch) | |
tree | a3535a4fdf9bdaf2564f8efe5bff02deeb5c4ced /src | |
parent | be7662bdcd3881d349bfba4c959a0c2be4159ce9 (diff) |
Fix (inactive) `MultSlice` rewrite
The `MultSlice` rewrite was previously accepting multiplications of
three and more variables even though it was designed for multiplications
of two variables only. Fortunately, the rewrite was not actively used in
the bitvector solver. This commit strengthens the condition in
`applies()` and adds a unit test that checks that x * y * z and x * y do
not get rewritten to the same term.
Diffstat (limited to 'src')
-rw-r--r-- | src/theory/bv/theory_bv_rewrite_rules_simplification.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/theory/bv/theory_bv_rewrite_rules_simplification.h b/src/theory/bv/theory_bv_rewrite_rules_simplification.h index 6ef591760..871380467 100644 --- a/src/theory/bv/theory_bv_rewrite_rules_simplification.h +++ b/src/theory/bv/theory_bv_rewrite_rules_simplification.h @@ -1108,13 +1108,10 @@ Node RewriteRule<MergeSignExtend>::apply(TNode node) { template<> inline bool RewriteRule<MultSlice>::applies(TNode node) { - if (node.getKind() != kind::BITVECTOR_MULT) { + if (node.getKind() != kind::BITVECTOR_MULT || node.getNumChildren() != 2) { return false; } - if (utils::getSize(node[0]) % 2 != 0) { - return false; - } - return true; + return utils::getSize(node[0]) % 2 == 0; } /** |