template<> inline
Node RewriteRule<NotIdemp>::apply(TNode node) {
Debug("bv-rewrite") << "RewriteRule<NotIdemp>(" << node << ")" << std::endl;
- return node[0][0];
+ TNode ret = node[0][0];
+ while (ret.getKind() == kind::BITVECTOR_NOT
+ && ret[0].getKind() == kind::BITVECTOR_NOT)
+ {
+ ret = ret[0][0];
+ }
+ return ret;
}
/* -------------------------------------------------------------------------- */
RewriteResponse TheoryBVRewriter::RewriteNot(TNode node, bool prerewrite){
Node resultNode = node;
-
- // // if(RewriteRule<NotXor>::applies(node)) {
- // // resultNode = RewriteRule<NotXor>::run<false>(node);
- // // return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
- // // }
- resultNode = LinearRewriteStrategy
- < RewriteRule<EvalNot>,
- RewriteRule<NotIdemp>
- >::apply(node);
-
+
+ resultNode =
+ LinearRewriteStrategy<RewriteRule<NotIdemp>, RewriteRule<EvalNot>>::apply(
+ node);
+
+ // It is is safe to return REWRITE_DONE here, because `NotIdemp` removes all
+ // pairs of `bvnot` and then `EvalNot` evaluates the remaining `bvnot` if
+ // applicable.
return RewriteResponse(REWRITE_DONE, resultNode);
}
regress0/bv/issue3621.smt2
regress0/bv/issue5396.smt2
regress0/bv/issue8159-1-rewrite-bvneg.smt2
+ regress0/bv/issue8240-rewrite-bvnot.smt2
regress0/bv/mul-neg-unsat.smt2
regress0/bv/mul-negpow2.smt2
regress0/bv/mult-pow2-negative.smt2