if (!prerewrite) {
resultNode = LinearRewriteStrategy
< RewriteRule<BitwiseSlicing>
- >::apply(node);
+ >::apply(resultNode);
if (resultNode.getKind() != node.getKind()) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
if (!prerewrite) {
resultNode = LinearRewriteStrategy
< RewriteRule<BitwiseSlicing>
- >::apply(node);
+ >::apply(resultNode);
if (resultNode.getKind() != node.getKind()) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
resultNode = LinearRewriteStrategy
< RewriteRule<XorOne>,
RewriteRule <BitwiseSlicing>
- >::apply(node);
+ >::apply(resultNode);
if (resultNode.getKind() != node.getKind()) {
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
RewriteResponse TheoryBVRewriter::RewritePlus(TNode node, bool prerewrite) {
- Node resultNode = LinearRewriteStrategy
- < RewriteRule<FlattenAssocCommut>,
+ Node resultNode = node;
+ if (prerewrite) {
+ resultNode = LinearRewriteStrategy
+ < RewriteRule<FlattenAssocCommut>
+ >::apply(node);
+ return RewriteResponse(REWRITE_DONE, resultNode);
+ }
+
+ resultNode = LinearRewriteStrategy
+ < RewriteRule<FlattenAssocCommut>,
RewriteRule<PlusCombineLikeTerms>
>::apply(node);
- if (prerewrite || node == resultNode) {
- return RewriteResponse(REWRITE_DONE, resultNode);
+
+ if (node != resultNode) {
+ return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
- return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
+ return RewriteResponse(REWRITE_DONE, resultNode);
}
RewriteResponse TheoryBVRewriter::RewriteSub(TNode node, bool prerewrite){