diff options
Diffstat (limited to 'src/theory/bv/theory_bv_rewriter.cpp')
-rw-r--r-- | src/theory/bv/theory_bv_rewriter.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/theory/bv/theory_bv_rewriter.cpp b/src/theory/bv/theory_bv_rewriter.cpp index 0f7629c5f..6b160ea67 100644 --- a/src/theory/bv/theory_bv_rewriter.cpp +++ b/src/theory/bv/theory_bv_rewriter.cpp @@ -171,9 +171,20 @@ RewriteResponse TheoryBVRewriter::RewriteITEBv(TNode node, bool prerewrite) Node resultNode = LinearRewriteStrategy<RewriteRule<EvalITEBv>, RewriteRule<BvIteConstCond>, - RewriteRule<BvIteEqualChildren>, - RewriteRule<BvIteConstChildren>, - RewriteRule<BvIteEqualCond>>::apply(node); + RewriteRule<BvIteEqualChildren>>::apply(node); + // If the node has been rewritten, we return here because we need to make + // sure that `BvIteEqualChildren` has been applied until we reach a fixpoint + // before applying `BvIteConstChildren`. Otherwise, `BvIteConstChildren` + // potentially performs an unsound rewrite. Returning hands back the control + // to the `Rewriter` which will then call this method again, ensuring that + // the rewrites are applied in the correct order. + if (resultNode != node) + { + return RewriteResponse(REWRITE_AGAIN, resultNode); + } + + resultNode = LinearRewriteStrategy<RewriteRule<BvIteConstChildren>, + RewriteRule<BvIteEqualCond>>::apply(node); if (resultNode != node) { return RewriteResponse(REWRITE_AGAIN, resultNode); |