From 92004d6524c7633aa1e014e5b727a39475652dda Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 4 Jun 2009 08:59:53 +0000 Subject: Sink getConstantValue into ConstantExpr. - Propogate ConstantExpr to various places, or cast as appropriate. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72862 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Solver/CexCachingSolver.cpp | 2 +- lib/Solver/FastCexSolver.cpp | 7 +++---- lib/Solver/STPBuilder.cpp | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/Solver') diff --git a/lib/Solver/CexCachingSolver.cpp b/lib/Solver/CexCachingSolver.cpp index 1eaec4d9..9c233530 100644 --- a/lib/Solver/CexCachingSolver.cpp +++ b/lib/Solver/CexCachingSolver.cpp @@ -220,7 +220,7 @@ bool CexCachingSolver::computeValidity(const Query& query, assert(isa(q) && "assignment evaluation did not result in constant"); - if (q->getConstantValue()) { + if (cast(q)->getConstantValue()) { if (!getAssignment(query, a)) return false; result = !a ? Solver::True : Solver::Unknown; diff --git a/lib/Solver/FastCexSolver.cpp b/lib/Solver/FastCexSolver.cpp index 1a1cfe62..6d9c8551 100644 --- a/lib/Solver/FastCexSolver.cpp +++ b/lib/Solver/FastCexSolver.cpp @@ -730,10 +730,9 @@ public: bool exprMustBeValue(ref e, uint64_t value) { CexConstifier cc(objectValues); ref v = cc.visit(e); - if (!isa(v)) return false; - // XXX reenable once all reads and vars are fixed - // assert(v.isConstant() && "not all values have been fixed"); - return v->getConstantValue() == value; + if (ConstantExpr *CE = dyn_cast(v)) + return CE->getConstantValue() == value; + return false; } }; diff --git a/lib/Solver/STPBuilder.cpp b/lib/Solver/STPBuilder.cpp index 88bdd2b0..5b3fdd60 100644 --- a/lib/Solver/STPBuilder.cpp +++ b/lib/Solver/STPBuilder.cpp @@ -449,7 +449,7 @@ ExprHandle STPBuilder::constructActual(ref e, int *width_out) { switch (e->getKind()) { case Expr::Constant: { - uint64_t asUInt64 = e->getConstantValue(); + uint64_t asUInt64 = cast(e)->getConstantValue(); *width_out = e->getWidth(); if (*width_out > 64) -- cgit 1.4.1