diff options
Diffstat (limited to 'lib/Solver/Solver.cpp')
-rw-r--r-- | lib/Solver/Solver.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Solver/Solver.cpp b/lib/Solver/Solver.cpp index 6cbf6ac0..3db049cd 100644 --- a/lib/Solver/Solver.cpp +++ b/lib/Solver/Solver.cpp @@ -56,8 +56,8 @@ bool Solver::evaluate(const Query& query, Validity &result) { assert(query.expr->getWidth() == Expr::Bool && "Invalid expression type!"); // Maintain invariants implementations expect. - if (query.expr->isConstant()) { - result = query.expr->getConstantValue() ? True : False; + if (ConstantExpr *CE = dyn_cast<ConstantExpr>(query.expr)) { + result = CE->getConstantValue() ? True : False; return true; } @@ -82,8 +82,8 @@ bool Solver::mustBeTrue(const Query& query, bool &result) { assert(query.expr->getWidth() == Expr::Bool && "Invalid expression type!"); // Maintain invariants implementations expect. - if (query.expr->isConstant()) { - result = query.expr->getConstantValue() ? true : false; + if (ConstantExpr *CE = dyn_cast<ConstantExpr>(query.expr)) { + result = CE->getConstantValue() ? true : false; return true; } @@ -151,8 +151,8 @@ std::pair< ref<Expr>, ref<Expr> > Solver::getRange(const Query& query) { default: min = 0, max = 1; break; } - } else if (e->isConstant()) { - min = max = e->getConstantValue(); + } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(e)) { + min = max = CE->getConstantValue(); } else { // binary search for # of useful bits uint64_t lo=0, hi=width, mid, bits=0; |