{
const bool flatten_ands = true;
const bool sort_extracts_last = false;
+ const bool debug_bvsolver = false;
//check the solver map for 'key'. If key is present, then return the
//value by reference in the argument 'output'
_bm->CreateTerm(BVPLUS, lhs.GetValueWidth(), o) :
o[0];
+ if (debug_bvsolver)
+ {
+ cerr << "Initial:" << eq;
+ cerr << "Chosen Monomial:" << outmonom;
+ cerr << "Output LHS:" << modifiedlhs;
+ }
+
// can be SYMBOL or (BVUMINUS SYMBOL) or (BVMULT ODD_BVCONST SYMBOL) or
// (BVMULT ODD_BVCONST (EXTRACT SYMBOL BV_CONST ZERO))
return outmonom;
don't have time. Trev.
*/
#if 1
- ASTNode aaa = (any_solved && EQ == it->GetKind()) ? _simp->applySubstitutionMapUntilArrays(*it) : *it;
-#else
+ ASTNode aaa = (any_solved && EQ == it->GetKind()) ? _simp->SimplifyFormula(_simp->applySubstitutionMapUntilArrays(*it),false,NULL) : *it;
+ #else
ASTNode aaa = *it;
if (any_solved && EQ == aaa.GetKind())
if (BVCONST == itk)
{
+ assert(savetheconst == rhs); // Returns the wrong result if there are >1 constants.
+
//check later if the constant is even or not
savetheconst = aaa;
continue;
}
}
-
// Write the constants into the main graph.
ASTNodeMap cache;
ASTNode result = SubstitutionMap::replace(top, fromTo, cache,nf);
if (0 != toConjoin.size())
{
- result = nf->CreateNode(AND, result, toConjoin); // conjoin the new conditions.
+ // It doesn't happen very often. But the "toConjoin" might contain a variable
+ // that was added to the substitution map (because the value was determined just now
+ // during propagation.
+ ASTNode conjunct = (1 == toConjoin.size())? toConjoin[0]: nf->CreateNode(AND,toConjoin);
+ conjunct = simplifier->applySubstitutionMap(conjunct);
+
+ result = nf->CreateNode(AND, result, conjunct); // conjoin the new conditions.
}