From 380ca8863db645f0c00843af2fef575b655783ff Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 14 Jun 2009 04:23:54 +0000 Subject: Add several ConstantExpr utility functions and move clients over. - Reducing uses of getConstantValue() so we can move to arbitrary precision constants. - No (intended) functionality change. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73324 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Solver/STPBuilder.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/Solver/STPBuilder.cpp') diff --git a/lib/Solver/STPBuilder.cpp b/lib/Solver/STPBuilder.cpp index ab65f254..8680d0a8 100644 --- a/lib/Solver/STPBuilder.cpp +++ b/lib/Solver/STPBuilder.cpp @@ -608,11 +608,10 @@ ExprHandle STPBuilder::constructActual(ref e, int *width_out) { assert(*width_out!=1 && "uncanonicalized sdiv"); if (ConstantExpr *CE = dyn_cast(de->right)) { - uint64_t divisor = CE->getConstantValue(); - if (optimizeDivides) { if (*width_out == 32) //only works for 32-bit division - return constructSDivByConstant( left, *width_out, divisor); + return constructSDivByConstant( left, *width_out, + CE->getConstantValue()); } } @@ -776,9 +775,9 @@ ExprHandle STPBuilder::constructActual(ref e, int *width_out) { ExprHandle left = construct(ee->left, width_out); ExprHandle right = construct(ee->right, width_out); if (*width_out==1) { - if (isa(ee->left)) { - assert(!cast(ee->left)->getConstantValue() && - "uncanonicalized eq"); + if (ConstantExpr *CE = dyn_cast(ee->left)) { + if (CE->isTrue()) + return right; return vc_notExpr(vc, right); } else { return vc_iffExpr(vc, left, right); -- cgit 1.4.1